I'm very short on time here, so I truly hope someone here has a clue how to fix these:
[proguard] Warning: android.support.v4.view.ViewConfigurationCompatFroyo: can't find referenced method 'int getScaledPagingTouchSlop()' in class android.view.ViewConfiguration
[proguard] Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentNavigableMap
[proguard] Note: org.codehaus.jackson.map.deser.BasicDeserializerFactory: can't find dynamically referenced class java.util.ConcurrentSkipListMap
[proguard] Note: there were 2 unresolved dynamic references to classes or interfaces.
[proguard] You should check if you need to specify additional program jars.
[proguard] Warning: there were 1 unresolved references to program class members.
[proguard] Your input classes appear to be inconsistent.
[proguard] You may need to recompile them and try again.
[proguard] Alternatively, you may have to specify the options
[proguard] '-dontskipnonpubliclibraryclasses' and/or
[proguard] '-dontskipnonpubliclibraryclassmembers'.
I already tried adding multiple things:
-dontwarn **CompatHoneycomb
-dontwarn **CompatCreatorHoneycombMR2
-keep class android.support.v4.** { *; }
and also (for the jackson errors):
-libraryjars /Libraries/Joda/joda-time-1.6.2.jar
-libraryjars /Libraries/stax2-api-3.0.0.jar
-libraryjars /Libraries/jsr311-api-0.8.jar
-libraryjars /Libraries/httpmime-4.0.1.jar
Anyone have a clue what i'm missing in my proguard.cfg for these references? Or potentially some tips on how to investigate / resolve it more generally?
I brought it down from 472 warnings to just these, mostly by adding the dontwarn statements:
-dontwarn java.awt.,javax.security.,java.beans.,javax.xml.,java.util.,org.w3c.dom.
EDIT: Migrated to Answer
-dontwarn **CompatHoneycomb
-dontwarn **CompatCreatorHoneycombMR2
-dontwarn android.support.v4.view.**
-keep class android.support.v4.** { *; }
-dontwarn java.awt.**,javax.security.**,java.beans.**,javax.xml.**,java.util.**,org.w3c.dom.**
Edited my post above to display the answer.
Found it.
These seemed to help.
-dontwarn **CompatHoneycomb
-dontwarn **CompatCreatorHoneycombMR2
-dontwarn android.support.v4.view.**
-keep class android.support.v4.** { *; }
-dontwarn java.awt.**,javax.security.**,java.beans.**,javax.xml.**,java.util.**,org.w3c.dom.**
Add the following to your proguard configuration file.
-keep class org.codehaus.jackson.** {
*;
}
You do not need to obscure 3rd party libraries.
Related
Already implemented below given solution but none of them are working still facing below listed warning.
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Add these lines into your proguard-rules.pro:
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
EDIT: try to add this:
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
into release buildType.
Adding below lines to the proguard will ignore these warnings solution from here
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
-dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
when I am setting minifiyEnabled to true in my any variant (debug or release) it gives me below error -
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
Warning:retrofit.appengine.UrlFetchClient: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader
Warning:library class android.webkit.WebView depends on program class android.net.http.SslCertificate
Warning:library class android.webkit.WebViewClient depends on program class android.net.http.SslError
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.conn.scheme.HostNameResolver
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.params.HttpConnectionParams depends on program class org.apache.http.params.HttpParams
Warning:there were 176 unresolved references to classes or interfaces.
Warning:there were 23 instances of library classes depending on program classes.
Warning:there were 6 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForProductionDebug'.
> Job failed, see logs for details
It is working fine in emulator or device if its lolipop or higher.
My problem resolved if i disable or make minifyEnabled to false, but I don't really want so.
My gradle tool is build:gradle:2.3.0'
And multiDexEnabled true
Note - I am not keeping any class or attribute in my proguard-rules.pro file.
After a lot of recherches and experiments I have got the solution. We have to add keep and dontwarn statments in our proguard-rules.pro file -
# Retrofit 1.X
-keep class com.squareup.okhttp.** { *; }
-keep class retrofit.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-dontwarn retrofit.**
-dontwarn rx.**
-keepclasseswithmembers class * {
#retrofit.http.* <methods>;
}
# If in your rest service interface you use methods with Callback argument.
-keepattributes Exceptions
# If your rest service methods throw custom exceptions, because you've defined an ErrorHandler.
-keepattributes Signature
# Proguard configuration for amazon Jackson 2.x (fasterxml package instead of codehaus package)
-keep class com.amazonaws.** { *; }
-keepnames class com.amazonaws.** { *; }
-dontwarn com.amazonaws.**
-dontwarn com.fasterxml.**
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**
-dontwarn org.hamcrest.**
-dontwarn android.test.**
-dontwarn android.support.test.**
-keep class org.hamcrest.** {
*;
}
-keep class org.junit.** { *; }
-dontwarn org.junit.**
-keep class junit.** { *; }
-dontwarn junit.**
-keep class sun.misc.** { *; }
-dontwarn sun.misc.**
-keep public class android.net.http.SslError
-keep public class android.webkit.WebViewClient
-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
Note - I followed the warnings in messages and by picking one by one put my proguard rule accordingly.
if you are define proper proguard rules and still issue then please minifyEnabled true use only for application level for other module use minifyEnabled false.
Also if any lintError found and its not possible to solve then use below code
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
I have checked that and its works after so much effort.
Try to add the following lines to your proguard configuration:
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
It's for retrofit library. For other external libs you can use this method with own packages which you want to ignore;
-dontwarn org.apache.** - for example
More about ProGuard usage you can find here
Proguard is having issues with the Lombok library when using Gradle in Android Studio to complile the library. I found some config info to fix butterknife, the other annotation library we use.
-keepattributes *Annotation*
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { #butterknife.InjectView *;}
Does anyone know the flags to add to make Lombok happy.
Proguard config file
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
# Optimizations: If you don't want to optimize, use the
# proguard-android.txt configuration file instead of this one, which
# turns off the optimization flags. Adding optimization introduces
# certain risks, since for example not all optimizations performed by
# ProGuard works on all versions of Dalvik. The following flags turn
# off various optimizations known to have issues, but the list may not
# be complete or up to date. (The "arithmetic" optimization can be
# used if you are only targeting Android 2.0 or later.) Make sure you
# test thoroughly if you go this route.
#-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable
-dontobfuscate
#-optimizationpasses 5
-allowaccessmodification
-dontpreverify
# The remainder of this file is identical to the non-optimized version
# of the Proguard configuration file (except that the other file has
# flags to turn off optimization).
#-dontusemixedcaseclassnames
#-dontskipnonpubliclibraryclasses
-verbose
-keepattributes *Annotation*
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { #butterknife.InjectView *;}
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
void set*(***);
*** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
A few of the errors I'm seeing...
Warning:lombok.core.Agent$NetbeansPatcherInfo$1: can't find superclass or interface java.lang.instrument.ClassFileTransformer
Warning:lombok.core.AnnotationProcessor: can't find superclass or interface javax.annotation.processing.AbstractProcessor
Warning:lombok.delombok.DocCommentIntegrator$CommentAttacher_8$1: can't find superclass or interface com.sun.tools.javac.parser.Tokens$Comment
Warning:lombok.delombok.PrettyCommentsPrinter: can't find superclass or interface com.sun.tools.javac.tree.JCTree$Visitor
Warning:lombok.delombok.PrettyCommentsPrinter$1UsedVisitor: can't find superclass or interface com.sun.tools.javac.tree.TreeScanner
Warning:lombok.delombok.ant.DelombokTask: can't find superclass or interface org.apache.tools.ant.Task
Warning:lombok.eclipse.EclipseAstProblemView$LombokProblem: can't find superclass or interface org.eclipse.jdt.internal.compiler.problem.DefaultProblem
Warning:lombok.eclipse.agent.ExtensionMethodCompletionProposal: can't find superclass or interface org.eclipse.jdt.internal.codeassist.InternalCompletionProposal
Warning:lombok.eclipse.handlers.SetGeneratedByVisitor: can't find superclass or interface org.eclipse.jdt.internal.compiler.ASTVisitor
Warning:lombok.installer.InstallerGUI$12: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$13: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$2: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$3: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$4: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$6: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$6$2: can't find superclass or interface javax.swing.filechooser.FileFilter
Warning:lombok.installer.InstallerGUI$7: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$8: can't find superclass or interface java.awt.event.ActionListener
Warning:lombok.installer.InstallerGUI$9: can't find superclass or interface java.awt.event.ActionListener
...
Warning: there were 10560 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.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 128 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.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning: there were 103 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
:just10:proguardGooglePhoneDevDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':just10:proguardGooglePhoneDevDebug'.
> java.io.IOException: Please correct the above warnings first.
I added some flags to suppress warnings for the included libraries in my project and that did the trick.
-dontwarn javax.**
-dontwarn lombok.**
-dontwarn org.apache.**
-dontwarn com.squareup.**
-dontwarn com.sun.**
-dontwarn **retrofit**
If you're using a compile directive in your gradle build file, change it to provided
In Eclipse, there's a similar solution where you can break the jar into a lombok-api.jar that you include in your libs. I tried looking for the instructions, but can't find the page that explained how you'd do that (This was over a year ago, so it may have changed).
Thanks to Roel (below), here's the commandline to use:
java -jar lombok.jar publicApi
This question already have been asked many times but I am not able to resolve it. I am trying to export my app using eclipse for final release BUT I am getting the below error. I added all entries which others have suggested in other links but no help. Please help me how to get rid of this error.
Proguard returned with error code 1. See console
[2014-08-24 11:21:11 - ] Note: there were 1035 duplicate class definitions.
[2014-08-24 11:21:11 - ] Warning:com.google.api.client.extensions.jdo.JdoDataStoreFactory$JdoValue: can't find superclass or interface javax.jdo.spi.PersistenceCapable
[2014-08-24 11:21:11 - ] Warning: com.google.api.client.extensions.jdo.JdoDataStoreFactory$JdoDataStore: can't find referenced class javax.jdo.PersistenceManagerFactory
[2014-08-24 11:21:11 -
[2014-08-24 11:21:11 - ] Warning: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential: can't find referenced class com.google.android.gms.common.AccountPicker
[2014-08-24 11:21:11 - ] Warning: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential: can't find referenced class com.google.android.gms.auth.GoogleAuthUtil
You should check if you need to specify additional program jars.
Warning: there were 127 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.
There was long error so I pasted relevant one. Below is my proguard-project.txt file entries.
-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
-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**
-keep class javax.ws.rs.** { *; }
-dontwarn com.fasterxml.jackson.**
-dontwarn org.xmlpull.v1.**
I resolved the issue. I added below two lines and now it is not giving any warning and I am able to generate .apk file successfully using eclipse.
-dontwarn javax.jdo.**
-dontwarn com.google.api.client.googleapis.extensions.android.gms.**
Hope it will help someone. Thanks
I get always with ProGuard following error:
[2012-05-19 17:50:13 - xxx] Warning: there were 13 unresolved references to program class members.
[2012-05-19 17:50:13 - xxx] Your input classes appear to be inconsistent.
[2012-05-19 17:50:13 - xxx] You may need to recompile them and try again.
[2012-05-19 17:50:13 - xxx] Alternatively, you may have to specify the option
[2012-05-19 17:50:13 - xxx] '-dontskipnonpubliclibraryclassmembers'.
[2012-05-19 17:50:13 - xxx] Error: Please correct the above warnings first.
[2012-05-19 17:55:40 - xxx] Proguard returned with error code 1. See console
[2012-05-19 17:55:40 - xxx] Note: there were 239 duplicate class definitions.
[2012-05-19 17:55:40 - xxx] Warning: org.apache.http.entity.mime.FormBodyPart: can't find superclass or interface org.apache.james.mime4j.message.BodyPart
[2012-05-19 17:55:40 - xxx] Warning: org.apache.http.entity.mime.HttpMultipart: can't find superclass or interface org.apache.james.mime4j.message.Multipart
[2012-05-19 17:55:40 - xxx] Warning: org.apache.http.entity.mime.MinimalField: can't find superclass or interface org.apache.james.mime4j.parser.Field
My proguard.cfg file is:
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }
-keepattributes *Annotation*
-keepattributes SourceFile, LineNumberTable
-libraryjars /libs/crittercism_v2_0_1.jar
-libraryjars /libs/dropbox-android-sdk-1.2.2.jar
-libraryjars /libs/FlurryAgent.jar
-libraryjars /libs/httpmime-4.0.3.jar
-libraryjars /libs/json_simple-1.1.jar
I've already added all my external libs so why am I getting always these errors?
Can anybody help?
EDIT 21.05.2012:
The problem is if you add "Dropbox" jar AND "ActionBarSherlock".
If I add only "Dropbox", I have no problem.
If I add only "ActionBarSherlock", I have no problem.
But if I added both, I would get the errors above.
The problem exists if you have added "ActionBarSherlock" and "DropBox" jars to your project.
To solve the problem, add the below line to your proguard-project.txt file:
-dontwarn org.apache.**
The warning will be ignored and it will work because each of the jars alone are working.
So I think, this will be the bug in ProGuard, if both are added.
Possibly you need to :
-keep class org.apache.http.**
-keep interface org.apache.http.**
That is assuming of course ProGuard is complaining about the apache classes. Admittedly I am guessing somewhat as I'm no expert on ProGuard.