crossRT
crossRT

Reputation: 686

Compile with Android Proguard error: can't find references?

I tried exporting my code to .apk file with Proguard but get a lot of warnings. I tried many solutions but can't fix it. Any ideas?

[2012-12-02 22:24:05 - com.crossrt.showtime.Main] Warning: android.support.v4.widget.ScrollerCompatIcs: can't find referenced method 'float getCurrVelocity()' in class android.widget.Scroller
[2012-12-02 22:24:05 - com.crossrt.showtime.Main] Warning: android.support.v4.widget.SearchViewCompatHoneycomb$1: can't find referenced class android.widget.SearchView$OnQueryTextListener
[2012-12-02 22:24:05 - com.crossrt.showtime.Main] Warning: android.support.v4.widget.SearchViewCompatHoneycomb$1: can't find referenced class android.widget.SearchView
[2012-12-02 22:24:05 - com.crossrt.showtime.Main] Warning: there were 242 unresolved references to classes or interfaces.
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]          You may need to specify additional library jars (using '-libraryjars').
[2012-12-02 22:24:05 - com.crossrt.showtime.Main] Warning: there were 47 unresolved references to program class members.
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]          Your input classes appear to be inconsistent.
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]          You may need to recompile them and try again.
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]          Alternatively, you may have to specify the option 
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]          '-dontskipnonpubliclibraryclassmembers'.
[2012-12-02 22:24:05 - com.crossrt.showtime.Main] java.io.IOException: Please correct the above warnings first.
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]   at proguard.Initializer.execute(Initializer.java:321)
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]   at proguard.ProGuard.initialize(ProGuard.java:211)
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]   at proguard.ProGuard.execute(ProGuard.java:86)
[2012-12-02 22:24:05 - com.crossrt.showtime.Main]   at proguard.ProGuard.main(ProGuard.java:492)

Upvotes: 2

Views: 7189

Answers (1)

Eric Lafortune
Eric Lafortune

Reputation: 45648

The support classes refer to run-time classes and methods that are not necessarily present in all Android versions. They do handle this in a safe way: the code works in all Android versions -- that's their purpose. You can therefore tell ProGuard to ignore the issues, in the configuration file proguard-project.txt:

-dontwarn android.support.**

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

Upvotes: 10

Related Questions