Cannot fix Android Proguard Returned with error code 1 error

筅森魡賤 提交于 2019-12-04 04:25:29

Add these lines to proguard config file (proguard-android.txt)

    -keep class android.support.v4.** { *; }   
    -dontwarn android.support.v4.**
    -dontwarn javax.activation.**
    -dontwarn javax.security.**
    -dontwarn java.awt.**
    -libraryjars <java.home>/lib/rt.jar
    -keep class javax.** {*;}
    -keep class com.sun.** {*;}
    -keep class myjava.** {*;}
    -keep class org.apache.harmony.** {*;}
    -keep public class Mail {*;}        
    -dontshrink

See Proguard Troubleshooting

Note that if you use

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

Your config file isn't the proguard-android.txt in your project root but the general proguard config file in the android sdk folder. If you want to use the proguard-android.txtin your project root you have to use

proguard.config=proguard-project.txt

in project.properties file.

Cfr. ProGuard manual > Troubleshooting > Warning: can't find referenced class

The AWT classes are not present in the Android SDK. ProGuard sees some classes that depend on them and warns about them, just like a compiler would do. Since the classes presumably are never really used, you can tell ProGuard to ignore it:

-dontwarn java.awt.**

ProGuard will then proceed processing the code. You shouldn't add any -libraryjars options.

in your error stack, at the bottom, pay attention to not on 'specify additional jars...'

Review your proguard config for inclusion of the android jar which includes all the referenced missing packages like 'javax' and 'awt' enter code here

try adding something like following to your proguard.cfg...

-libraryjars  /usr/local/src/android-sdk-linux/platforms/android-18/android.jar
-libraryjars <java.home>/lib/rt.jar

update your progaurd to the latest version 4.10 from this link

http://sourceforge.net/projects/proguard/files/proguard/4.10/

unzip the file and replace the content in your android sdk directory (progaud folder in tools directory)

[path to android sdk] \Android\android-sdk\tools\proguard

then try again, you might need to restart eclipse.

I've successfully ignored the invalid package errors in eclipse in the following procedure:

right click on the project > Properties > android lint reference > in the search line type "invalid" > and mark the id = InvalidPackage > and on the lower right change severity to ignore.

Note, its a dirty workaround (I could not make the proguard ignore so...)

good luck!

I had the same problem in eclipse. I could resolve it by adding

-ignorewarnings

in the progaurd-project.txt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!