Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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]          '-dontskipnonpubliclibraryclassmembers'.
[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)
like image 616
GoranK Avatar asked Jul 02 '11 23:07

GoranK


2 Answers

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

like image 171
Eric Lafortune Avatar answered Nov 13 '22 16:11

Eric Lafortune


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.

like image 26
Kevin TeslaCoil Avatar answered Nov 13 '22 15:11

Kevin TeslaCoil