开发者

Proguard error when exporting signed app using android.support.v4.app honeycomb compatibility package

I am using v4 compatibility package in my project, but when I try to export a signed app, I get the following message from Proguard. I've Googled the whole evening, but I didn't find the answer to solve this.

[2011-07-03 01:46:29 - worldscopeApp] Proguard returned with error code 1. See console
[2011-07-03 01:46:29 - worldscopeApp] Warning: android.support.v4.app.ActivityCompatHoneycomb: can't find referenced method 'void invalidateOptionsMenu()' in class android.app.Activity
[2011-07-03 01:46:29 - worldscopeApp] Warning: android.support.v4.app.ActivityCompatHoneycomb: can't find referenced method 'void dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[])' in class android.app.Activity
[2011-07-03 01:46:29 - worldscopeApp] Warning: android.support.v4.view.MenuCompatHoneycomb: can't find referenced method 'void setShowAsAction(int)' in class android.view.MenuItem
[2011-07-03 01:46:29 - worldscopeApp]       You should check if you need to specify additional program jars.
[2011-07-03 01:46:29 - worldscopeApp] Warning: there were 3 unresolved references to program class members.
[2011-07-03 01:46:29 - worldscopeApp]          Your input classes appear to be inconsistent.
[2011-07-03 01:46:29 - worldscopeApp]          You may need to recompile them and try again.
[2011-07-03 01:46:29 - worldscopeApp]          Alternatively, you may have to specify the options 
[2011-07-03 01:46:29 - worldscopeApp]          '-dontskipnonpubliclibraryclasses' and/or
[2011-07-03 01:46:29 - worldscopeApp]          '-dontskipnonpubliclibrarycla开发者_运维技巧ssmembers'.
[2011-07-03 01:46:29 - worldscopeApp] java.io.IOException: Please correct the above warnings first.
[2011-07-03 01:46:29 - worldscopeApp]   at proguard.Initializer.execute(Initializer.java:308)
[2011-07-03 01:46:29 - worldscopeApp]   at proguard.ProGuard.initialize(ProGuard.java:210)
[2011-07-03 01:46:29 - worldscopeApp]   at proguard.ProGuard.execute(ProGuard.java:85)
[2011-07-03 01:46:29 - worldscopeApp]   at proguard.ProGuard.main(ProGuard.java:499)


It looks like some clases in android.support.v4 are not quite compatible with some classes in android. If you're sure this is not a problem, you can specify

-dontwarn android.support.v4.**

ProGuard will then ignore these problems and continue processing the code.

See the ProGuard manual > Troubleshooting > Warning: can't find referenced field/method


This is what I'm using in my proguard.cfg:

-dontwarn **CompatHoneycomb
-keep public class * extends android.support.v4.app.Fragment

More general is:

-dontwarn **CompatHoneycomb
-keep class android.support.v4.** { *; }

But it'll cause a larger APK size so only use if the first one isn't working.


You should set the android:targetSdkVersion to an SDK >= honeycomb.

For information I am using this one

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜