Android Obfuscation package configuration (ignoring third-party jar)

Source: Internet
Author: User

Add Proguard.config=proguard.cfg to the project.properties.

The PROGUARD.CFG configuration is as follows:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations!code/simplification/arithmetic,!field/*,!class/merging/*

#忽略警告 can also use-ignorewarnings
-dontwarn

#声明第三方jar包, regardless of the. So file in the third-party jar package (if any)
-libraryjars Libs/baidumapapi.jar
-libraryjars Libs/tencent_openapi.jar
-libraryjars Libs/httpmime-4.1.3.jar
-libraryjars Libs/weibo.sdk.android.sso.jar
-libraryjars Libs/android-support-v4.jar

-keep public class * extends ANDROID.APP.ACTIVITY
-keep public class * extends ANDROID.APP.APPLICATION
-keep public class * extends ANDROID.CONTENT.BROADCASTRECEIVER
-keep public Class * extends ANDROID.CONTENT.CONTENTPROVIDER
-keep public class * extends ANDROID.APP.BACKUP.BACKUPAGENTHELPER
-keep public class Com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
Native <methods>;
}

-keepclasseswithmembers class * {
Public <init> (Android.content.Context, Android.util.AttributeSet);
}

-keepclasseswithmembers class * {
Public <init> (Android.content.Context, Android.util.AttributeSet, int.);
}

-keepclassmembers class * extends Android.app.Activity {
public void * (Android.view.View);
}

-keepclassmembers enum * {
public static **[] values ();
public static * * VALUEOF (java.lang.String);
}

-keep class * Implements Android.os.Parcelable {
public static final Android.os.parcelable$creator *;
}

#不混淆第三方jar包中的类
-keep class com.baidu.mapapi.** {*;}
-keep class com.tencent.tauth.** {*;}
-keep class org.apache.http.entity.mime.** {*;}
-keep class android.support.v4.** {*;}
-keep class android.net.http.** {*;}
-keep class com.weibo.sdk.android.** {*;}
-keep class com.sina.sso.** {*;}

Note that if there is a. So file in the third-party jar package, do not bother with the introduction of third-party jar files do not confuse, otherwise you may report an exception

Android Obfuscation package configuration (ignoring third-party jar)

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.