Error while Setting of Proguard and Exporting APK

后端 未结 3 563
遥遥无期
遥遥无期 2020-12-10 18:33

I am doing first-time Proguard setting on My Android Project and Exporting My APK File but I got Following errors: (I also not found any proguard.cfg file in my

相关标签:
3条回答
  • 2020-12-10 18:45

    Finally I Got Answer with the help of this Tutorial

    I have changed following things:

    In project.properties: Uncomment or add this line:

    proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
    

    Now I have used Google Library so my proguard.project.txt will be like:

    Here add your libraries which you have used in your project:

    -libraryjars /libs/google-api-client-1.10.3-beta.jar
    -libraryjars /libs/google-api-client-android2-1.10.3-beta.jar
    -libraryjars /libs/google-http-client-1.10.3-beta.jar
    -libraryjars /libs/google-http-client-android2-1.10.3-beta.jar
    -libraryjars /libs/google-oauth-client-1.10.1-beta.jar
    -libraryjars /libs/gson-2.1.jar
    -libraryjars /libs/guava-11.0.1.jar
    -libraryjars /libs/jackson-core-asl-1.9.4.jar
    -libraryjars /libs/jsr305-1.3.9.jar
    -libraryjars /libs/protobuf-java-2.2.0.jar
    -libraryjars /libs/maps.jar
    

    Add any project specific keep options here:

    -keep class com.google.**
    -dontwarn com.google.**
    

    Then you can Export your APK using following steps:

    • Right click on project
    • select Export
    • Follow Steps

    If you have any Query then you are free to ping me :)

    Thank you.

    0 讨论(0)
  • 2020-12-10 18:48

    Using Maven in my case, google-api-client brought guava-jdk5 as a dependency, causing similar problems.

    Guava wiki page on Proguard suggests: https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava

    -dontwarn sun.misc.Unsafe
    -dontwarn com.google.common.collect.MinMaxPriorityQueue
    
    0 讨论(0)
  • 2020-12-10 19:06

    Add these line in your proguard-project.txt

    -keep public class com.google.common.**
    -keep public class * extends android.app.Activity
    
    0 讨论(0)
提交回复
热议问题