Android code confuses those things

Source: Internet
Author: User

The role of code obfuscation will not be said. Here's a baidumapdemo example of code obfuscation:

This is the approximate outline of this project:


(1) No confusion after the APK anti-compilation situation:


Specific to the situation under each package:



It can be seen that the confusion is only a third-party jar package, which is not something we confuse, but a third-party jar package that comes with confusion.

(2) Then we start to confuse:

Take two steps:

(|) First step: Open Project.Properties



The original file is this:


See line 11th, and remove the # from the front of line 11th.

Became like this:


Here we are already confused. The result of the confusion is this:


You can see that the android.support.v4 is confused (should not be confused or necessary), the third party jar package is confused (originally they have been confused, and then you are confused).

To solve the above problems, you must specify those things to confuse those things without confusion, as follows:

Add in Proguard-project:

-libraryjars Libs/baidumapapi_v3_2_0.jar-dontwarn Com.baidu.mapapi.**-dontwarn Com.baidu.platform.**-dontwarn Com.baidu.location.**-dontwarn Com.baidu.vi.**-dontwarn Vi.com.gdi.bgl.android.**-dontwarn com.baidu.lbsapi.**- Dontwarn Com.baidu.android.**-dontwarn Android.support.v4.**-keep class com.baidu.mapapi.** {*;} -keep class com.baidu.platform.** {*;} -keep class com.baidu.location.** {*;} -keep class com.baidu.vi.** {*;} -keep class com.baidu.lbsapi.** {*;} -keep class vi.com.gdi.bgl.android.** {*;} -keep class com.baidu.android.** {*;} -keep class android.support.v4.** {*;} -keep interface android.support.v4.app.** {*;}   
The specific meaning can be referred to:

Http://www.cnblogs.com/sw926/p/3314165.html

Note that code obfuscation is only performed when your apk is signed, and you will not be confused during normal debugging.











Android code confuses those things

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.