Solve the Problem of obfuscation of third-party jars after Android SDK R17

Source: Internet
Author: User

Since Google upgraded the SDK to R17 or later. The proguard rule has been modified. problems may occur after export using third-party jar.

If the export package is not configured, the system will prompt-libraryjars and add it to the JAR file. After countless attempts, the export package will be reduced. After decompilation, it is found that the JAR file is not packaged.

Once you add a jar file, the habit is to create a lib directory. Of course, there may be third-party projects, but there is no impact.

-injars  /lib/zxing_core.jar-libraryjars /lib/zxing_core.jar

Add-injars to the configuration file and add the package to the package.

However, the previous SDK may be incompatible, so it is best to have two sets of proguard files in the project. Select different configuration files for different sdks.

R18 an error will be reported when you export the package. I don't know if it is a JDK problem. I have JDK 7 64-bit.

The release mode is okay, but a serious problem is found. Third-Party Jar packages in debug mode cannot be entered.

Found the solution

Build path, Java build path, select libraries, click "add library" on the right and select "User library ", click "Next" and click "User librarys". On the displayed page, click "New .. click "OK" and click "add jars" to select a third-party jar package. Click "OK. The subsequent steps are very important if you do not perform subsequent operations. In eclipse, the compilation is passed and no errors are displayed. However, Java may occur when running on a simulator or a real machine. lang. noclassdeffounderror: 1. Create a libs folder under the root directory of the android project; 2. Copy the third-party jar package you need to import to this directory; 3. Right-click the libs directory and choose bulid path-> use as source folder. This is done. Very simple.

In fact, the new version of the SDK is still good, there is a problem to solve the problem, after all, there must be good new things, although some things have been abandoned, always cannot use the old version, research for a long time, now.

Correct: We found that there will be a jar package in debug mode and a jar package in release. All JNI users know that there is a libs folder.

We can ignore this. Now we just need to copy the jar directly to the libs directory, and we don't need to-injars to confuse the file. As for why, the libs folder can be fixed. You can think that libs is a system folder. during compilation, the SDK will scan this folder.

Related Article

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.