Akward Proguard error on new (blank) project - android

After creating new android project I just put the name and package name... and nothing else
then in the project.properties I add
proguard.config=proguard-project.txt
then if I try to export signed apk I get this error
[2013-09-19 12:05:57 - ProguardTest] Warning: there were 12 unresolved
references to classes or interfaces. [2013-09-19 12:05:57 -
ProguardTest] You may need to specify additional library jars
(using '-libraryjars'). [2013-09-19 12:05:57 - ProguardTest] Warning:
there were 12 unresolved references to program class members.
[2013-09-19 12:05:57 - ProguardTest] Your input classes
appear to be inconsistent. [2013-09-19 12:05:57 - ProguardTest]
You may need to recompile them and try again. [2013-09-19 12:05:57 -
ProguardTest] Alternatively, you may have to specify the
option [2013-09-19 12:05:57 - ProguardTest]
'-dontskipnonpubliclibraryclassmembers'. [2013-09-19 12:05:57 -
ProguardTest] Error: Please correct the above warnings first.
This is the strange part if I untick "Android Private Libraries" on the Order and Export tab of the build path editor it just works fine

Depending on the details in the error log (before the quoted lines), you may need to add missing libraries, build against a more recent Android runtime, or just specify -ignorewarnings or -dontwarn.
See the ProGuard manual > Troubleshooting > Warning: can't find referenced class
See the ProGuard manual > Troubleshooting > Warning: can't find referenced field/method '...' in program class ...
Note that proguard.config in the file project.properties typically also points to a generic configuration file proguard-android.txt inside the Android SDK. The file proguard-project.txt then only needs to contain project-specific configuration.

Related

Proguard issue when enabling it

Proguard returned with error code 1. See console
Warning: com.google.android.gms.ads.formats.NativeAdView: can't find referenced method 'FrameLayout(android.content.Context,android.util.AttributeSet,int,int)' in class android.widget.FrameLayout
You should check if you need to specify additional program jars.
Warning: there were 1 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
I change the Project Build Target from Android 4.4.2 to Android 5.1.1 and then the problem does not happen again.
Hope it helps.

Warning with Proguard and EndlessAdapter. App crashes

Have errors on exporting android app and proguard. Without using proguard, app works ok. I have com.commonsware.cwac.endless.EndlessAdapter library as third party in my code, and proguard throws that error when exporting the project...
Proguard returned with error code 1. See console
Warning: com.commonsware.cwac.endless.EndlessAdapter: can't find referenced field 'java.util.concurrent.Executor THREAD_POOL_EXECUTOR' in class android.os.AsyncTask
Warning: com.commonsware.cwac.endless.EndlessAdapter: can't find referenced method 'android.os.AsyncTask executeOnExecutor(java.util.concurrent.Executor,java.lang.Object[])' in class android.os.AsyncTask
You should check if you need to specify additional program jars.
Warning: there were 2 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the option '-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
Any idea? Something extra to put in my proguard-project.txt??? Thankssss
This field and this method are only available in android-11 or higher, so you should build against the target android-11 or higher. Can can still specify a different targetSdkVersion in your AndroidManifest.xml file.

Why is ProGuard suddenly unable to compile my application?

I've been using Android Studio since the initial release without any ProGuard issues. Suddenly today it has stopped working. As far as I know any files which would interfere with Proguard have not changed. For instance my ProGuard config file remains untouched, and ActionBarSherlock (one of the modules now experiencing errors) was not changed in any way since the last successful build.
The error log recommended using -dontskipnonpubliclibraryclassmembers however that does not resolve the issue. Running ProGuard with the included default configuration rather than my own still results in the same errors.
From what I can make of it, when Android Studio is building my app, the modules are now being stripped from the app. I'm not sure if it's just not passing the appropriate flags to ProGuard or if Proguard is removing them on its own.
Some relevant logs:
ProGuard: [Meditation Assistant] Warning: com.actionbarsherlock.widget.SuggestionsAdapter: can't find referenced field 'android.content.Context mContext' in class com.actionbarsherlock.widget.SuggestionsAdapter
ProGuard: [Meditation Assistant] Warning: com.actionbarsherlock.widget.SuggestionsAdapter: can't find referenced method 'android.database.Cursor getCursor()' in class com.actionbarsherlock.widget.SuggestionsAdapter
ProGuard: [Meditation Assistant] Warning: com.actionbarsherlock.widget.SuggestionsAdapter: can't find referenced field 'android.database.Cursor mCursor' in class com.actionbarsherlock.widget.SuggestionsAdapter
--snip--
ProGuard: [Meditation Assistant] You should check if you need to specify additional program jars.
ProGuard: [Meditation Assistant] Warning: there were 10 unresolved references to classes or interfaces.
ProGuard: [Meditation Assistant] You may need to specify additional library jars (using '-libraryjars').
ProGuard: [Meditation Assistant] Warning: there were 191 unresolved references to program class members.
The message
Warning: there were 10 unresolved references to classes or interfaces.
suggests that ProGuard can't find some classes that are required. These classes are listed in ProGuard's earlier console output. You should check that all the necessary jars are in the directory 'libs'. In this case, android-support-v4.jar might be missing.
I solved it adding the following line to proguard-project.txt:
-libraryjars libs/android-support-v4.jar
In case of using Eclipse do not forget to clean the project before exporting the APK.

socialauth-android: proguard errors when exporting apk

Using socialauth-android, when I try to export my project I get these warnings:
Warning: org.brickred.socialauth.util.SocialAuthUtil: can't find referenced class javax.servlet.http.HttpServletRequest
Warning: there were 111 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
Warning: there were 140 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code or update the library versions.
Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:330)
at proguard.ProGuard.initialize(ProGuard.java:212)
at proguard.ProGuard.execute(ProGuard.java:87)
at proguard.ProGuard.main(ProGuard.java:484)
Could someone help?
Problem is gone using this proguard cfg:
-keep class org.brickred.** { *; } -dontwarn org.brickred.**
Do you have the jars directly in your libs? Or are you getting them through maven? Which sdk version are you running?
If you add jars in at compile time, it might not get included in proguard processing. The jars has to be in place after pre-build target is ran.

Proguard giving the following error while exporting the application

Warning: library class android.webkit.WebView depends on program class android.webkit.WebViewClient
Warning: there were 1 instances of library classes depending on program classes.
You must avoid such dependencies, since the program classes will
be processed, while the library classes will remain unchanged.
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:308)
at proguard.ProGuard.initialize(ProGuard.java:210)
at proguard.ProGuard.execute(ProGuard.java:85)
at proguard.ProGuard.main(ProGuard.java:499)
Can anyone specify the complete procedure to proguard my application.
This warning is described here:
ProGuard manual > Troubleshooting > Warning: library class ... depends on program class ...
A complete configuration for Android is provided here:
ProGuard manual > Examples > A complete Android application
However, the easiest way is probably the build process of the Android SDK, which includes ProGuard:
Android SDK Dev Guide > Tools > ProGuard

Categories

Resources