Two apps Merge

Source: Internet
Author: User

We need to combine two apps to add a feature to the original project. Project A and project B are as follows:

In the beginning, we separate project B into a module, and then, as a library, it is called to project A.

The problem is that the application, activity and duplicate packages already exist in Project B, how does this need to be solved?

The application of Project B can be combined with the application of project A, but the activity needs to be managed, and the problem is that only the major projects have activity. There is no ordinary project??

Later, due to the lack of certainty, it is still the traditional method, the direct separation of Project B, the resource files in res, Java files placed in the src,application merged together, Androidmanifest merged together.

1. The main problems encountered are:

(1) Due to the introduction of the third-party library minimum supported version is higher than the minimum supported version of Project A, you will be prompted:

Error:execution failed for task ': App:processdebugmanifest '.
> Manifest merger failed:uses-sdk:minsdkversion 8 cannot be smaller than version 9 declared in library [jp.wasabeef:b lurry:1.0.0]/users/xxx/xxx/app/build/intermediates/exploded-aar/jp.wasabeef/blurry/1.0.0/androidmanifest.xml
Suggestion:use tools:overridelibrary= "Jp.wasabeef.blurry" to force usage

Solution: Increase the minimum supported version of a third-party library, or reduce the minimum supported version of project A, or use using Tools:overridelibrary = "Xxx.xxx.xxx" as prompted to resolve the issue

(2) because the imported jar packages are duplicated, you will be prompted:

Solution: Locate the duplicate package, and then delete the

(3) because there is not enough memory allocated to the application, there is a

Exception in thread "main" Java.lang.OutOfMemoryError:GC overhead limit exceeded

Solution: Added a build.gradule in the

Dexoptions{javamaxheapsize "2g"}

(4) All of theApp 's code is in a dex file, and Dex's method number is controlled from 0 to 65536, and if Dex has too many methods, it will not work. Therefore, according to the official statement, a. In the defaultconfig of Gradule.gradule is added

multidexenabled true

B. Add this paragraph to the application (before the method has been separated, and then need to merge to the same application)

@Override

protected void Attachbasecontext (Context base)

{

Super.attachbasecontext (base);

Multidex.install (this);

}

The main problem, also as above, on the whole, for Android Studio A lot of understanding, such as shortcut keys, Gradule, module, project, debugging use, are unfamiliar, need to gradually upgrade their Android Studio Awareness (can refer to the official documentation for more information)

Two apps Merge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.