Proguard causing error while building release apk - android

Note: there were 1188 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Initializing...
Note: the configuration refers to the unknown class 'rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef'
Note: the configuration refers to the unknown class 'rx.internal.util.atomic.LinkedQueueNode'
Note: the configuration refers to the unknown class 'rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef'
Note: the configuration refers to the unknown class 'rx.internal.util.atomic.LinkedQueueNode'
Note: the configuration refers to the unknown class 'dagger.internal.Binding'
Maybe you meant the fully qualified name 'com.sun.xml.internal.ws.wsdl.writer.document.Binding'?
Maybe you meant the fully qualified name 'com.sun.xml.internal.ws.wsdl.writer.document.http.Binding'?
Maybe you meant the fully qualified name 'dagger.internal.codegen.Binding'?
Maybe you meant the fully qualified name 'javax.naming.Binding'?
Maybe you meant the fully qualified name 'javax.xml.ws.Binding'?
Maybe you meant the fully qualified name 'org.eclipse.jdt.internal.compiler.lookup.Binding'?
Maybe you meant the fully qualified name 'org.omg.CosNaming.Binding'?
Note: the configuration refers to the unknown class 'dagger.internal.ModuleAdapter'
Note: the configuration refers to the unknown class 'dagger.internal.StaticInjection'
Note: the configuration refers to the unknown class 'Object'
Maybe you meant the fully qualified name 'java.lang.Object'?
Maybe you meant the fully qualified name 'org.omg.CORBA.Object'?
Note: the configuration refers to the unknown class 'org.greenrobot.eventbus.Subscribe'
Maybe you meant the fully qualified name 'com.squareup.otto.Subscribe'?
Maybe you meant the fully qualified name 'com.google.common.eventbus.Subscribe'?
Note: the configuration refers to the unknown class 'org.greenrobot.eventbus.ThreadMode'
Note: the configuration refers to the unknown class 'org.greenrobot.eventbus.util.ThrowableFailureEvent'
Note: the configuration refers to the unknown class 'com.google.android.gms.location.LocationServices'
Note: the configuration refers to the unknown class 'com.abed.hexagonrecyclerview.view.HorizontallyAdaptableHexagonImageView'
Note: the configuration refers to the unknown class 'com.abed.hexagonrecyclerview.view.VerticallyAdaptableHexagonImageView'
Note: the configuration refers to the unknown class 'com.facebook.drawee.view.SimpleDraweeView'
Warning: library class dagger.producers.monitoring.internal.Monitors$1 extends or implements program class javax.inject.Provider
Note: bo.app.aw: can't find dynamically referenced class com.amazon.device.messaging.ADM
Note: com.google.android.exoplayer.extractor.ExtractorSampleSource: can't find dynamically referenced class com.google.android.exoplayer.ext.flac.FlacExtractor
Note: com.google.android.gms.internal.zzast: can't find dynamically referenced class android.os.SystemProperties
Note: com.google.android.youtube.player.internal.aa: can't find dynamically referenced class com.google.android.youtube.api.locallylinked.LocallyLinkedFactory
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform$CloseGuard: can't find dynamically referenced class dalvik.system.CloseGuard
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: com.google.android.gms.dynamite.DynamiteModule accesses a declared field 'MODULE_ID' dynamically
Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags.ModuleDescriptor { java.lang.String MODULE_ID; }'
Note: com.google.android.gms.dynamite.DynamiteModule accesses a declared field 'MODULE_VERSION' dynamically
Maybe this is program field 'com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags.ModuleDescriptor { int MODULE_VERSION; }'
Note: com.google.android.gms.dynamite.DynamiteModule accesses a declared field 'sClassLoader' dynamically
Maybe this is program field 'com.google.android.gms.dynamite.DynamiteModule$DynamiteLoaderClassLoader { java.lang.ClassLoader sClassLoader; }'
Note: com.google.gson.internal.UnsafeAllocator accesses a declared field 'theUnsafe' dynamically
Note: the configuration explicitly specifies 'sun.misc.Unsafe' to keep library class 'sun.misc.Unsafe'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParser'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParserException'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParserFactory'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlSerializer'
Note: there were 15 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 5 library classes explicitly being kept.
You don't need to keep library classes; they are already left unchanged.
(http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass)
Note: there were 11 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 4 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
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.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
:app:transformClassesAndResourcesWithProguardForRelease (Thread[Daemon worker Thread 3,5,main]) completed. Took 4.602 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 7.685 secs
Stopped 0 worker daemon(s).

I solved this error by adding few lines in proguard. I was using twitter library in gradle.
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
-printmapping mapping.txt
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
-dontwarn com.squareup.okhttp.**
-dontwarn com.google.appengine.api.urlfetch.**
-dontwarn rx.**
-dontwarn retrofit.**
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
#retrofit.http.* <methods>;
}

Make sure to upgrade to the latest Gradle version to use the
annotationProcessor syntax:
dependencies {
compile "com.google.dagger:dagger:2.9"
annotationProcessor "com.google.dagger:dagger-compiler:2.9"
provided 'javax.annotation:jsr250-api:1.0'
}
Taken from android wiki in codepath

Related

After exclude module 'answer-shim' in the android gradle for io.branch.sdk couldn't build with proguard

When try to build the release build with proguard enable getting below warning and couldn't build the APK successfully.
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEvent
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.AnswersOptionalLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEventLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.AnswersOptionalLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEventLogger
Warning:io.branch.referral.ExtendedAnswerProvider: can't find referenced class com.crashlytics.android.answers.shim.KitEvent
Warning:there were 14 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:java.lang.RuntimeException: Job failed, see logs for details
Error:java.io.IOException: Please correct the above warnings first.
add
-dontwarn com.crashlytics.android.answers.shim.**
to the proguard file
If you want to exclude Crashlytics from Proguard you can use these 2 lines
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
Check out Fabric's Proguard page

ProGuard error trying to generate signed apk

This is my log. the problem happens when I try to generate signed apk:
Initializing...
Note: the configuration refers to the unknown class 'com.sourcey.example.SignupActivity'
Note: com.google.android.gms.internal.zzro calls 'Field.getType'
Note: butterknife.internal.ViewInjector calls 'Class.getEnclosingClass'
Warning:com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning:com.google.android.gms.gcm.zza: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Note: com.google.android.gms.maps.internal.zzy: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImplGmm6
Note: com.google.android.gms.maps.internal.zzy: can't find dynamically referenced class com.google.android.gms.maps.internal.CreatorImpl
Note: org.apache.james.mime4j.storage.DefaultStorageProvider calls '(org.apache.james.mime4j.storage.StorageProvider)Class.forName(variable).newInstance()'
Note: there were 1 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 1 classes trying to access generic signatures using reflection.
You should consider keeping the signature attributes
(using '-keepattributes Signature').
(http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 1 classes trying to access enclosing classes using reflection.
You should consider keeping the inner classes attributes
(using '-keepattributes InnerClasses').
(http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 2 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 1 class casts of dynamically created class instances.
You might consider explicitly keeping the mentioned classes and/or
their implementations (using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclasscast)
Warning:there were 2 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
Information:BUILD FAILED
Information:Total time: 22.714 secs
Information:1 error
Information:4 warnings
Information:See complete output in console
My module build.grade:
defaultConfig {
applicationId "com.sourcey.example"
minSdkVersion 15
//targetSdkVersion 22
targetSdkVersion 23
versionCode 28
versionName "3.0.2.1"
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
May be the problem is the warnings but I don't know
My project build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Finally, my proguard-rules.pro:
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { #butterknife.InjectView *;}
-dontwarn butterknife.Views$InjectViewProcessor
-dontwarn com.gc.materialdesign.views.**
-dontwarn com.kosalgeek.**
-dontwarn org.apache.**
-dontwarn android.support.v4.**
Thanks for helping me!
Thanks a lot
You have 2 warnings originating from Google GMS services. To ignore them use the following configuration:
-dontwarn com.google.android.gms.**
There are also a few more notes that you should also take into account:
-keepattributes Signature,InnerClasses
The remaining notes are more or less harmless, but you may want to ignore them with appropriate -dontnote configurations.

Proguard build failure with Lombok annotation library

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

Android ant build: proguard can't find referenced method in class ViewConfigurationCompatFroyo

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.

Android ProGuard error with org.xmlpull.v1.XmlPullParser

When my application is build with ProGuard, it fails with following message.
I use a default proguard.cfg generated by Android SDK with some -libraryjars.
What can I do for it?
[2011-03-17 09:27:04 - MyProject] Proguard returned with error code 1. See console
[2011-03-17 09:27:04 - MyProject] Note: there were 4247 duplicate class definitions.
[2011-03-17 09:27:04 - MyProject] Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.AnimationDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] You should check if you need to specify additional program jars.
[2011-03-17 09:27:04 - MyProject] Warning: there were 9 instances of library classes depending on program classes.
[2011-03-17 09:27:04 - MyProject] You must avoid such dependencies, since the program classes will
[2011-03-17 09:27:04 - MyProject] be processed, while the library classes will remain unchanged.
[2011-03-17 09:27:04 - MyProject] java.io.IOException: Please correct the above warnings first.
[2011-03-17 09:27:04 - MyProject] at proguard.Initializer.execute(Initializer.java:321)
[2011-03-17 09:27:04 - MyProject] at proguard.ProGuard.initialize(ProGuard.java:211)
[2011-03-17 09:27:04 - MyProject] at proguard.ProGuard.execute(ProGuard.java:86)
[2011-03-17 09:27:04 - MyProject] at proguard.ProGuard.main(ProGuard.java:492)
Apparently, org.xmlpull.v1.XmlPullParser is not a program class.
I've updated ProGuard to newest version(4.6), but have same warnings.
add this line to proguard-project.txt
-dontwarn org.xmlpull.v1.**
and this line to project.properties
proguard.config=proguard-project.txt
I solved this using this settings in the proguard file:
-dontwarn org.kobjects.**
-dontwarn org.ksoap2.**
-dontwarn org.kxml2.**
-dontwarn org.xmlpull.v1.**
-keep class org.kobjects.** { *; }
-keep class org.ksoap2.** { *; }
-keep class org.kxml2.** { *; }
-keep class org.xmlpull.** { *; }
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontoptimize
-dontpreverify
I don't have the solution yet for proguard run via eclipse for android, but if you run proguard manually from the command line, you can put the following in your proguard.cfg:
-basedirectory /home/pjv/workspace/collectionista-repo/collectionista-main
-injars /tmp/android_4500371803543847111.jar
-injars libs/joda-time-1.6.jar(!META-INF/MANIFEST.MF)
-injars libs/FlurryAgent.jar(!META-INF/MANIFEST.MF)
-injars libs/veecheck-2.0.jar(!META-INF/MANIFEST.MF)
-injars libs/commons-lang-2.4.jar(!META-INF/MANIFEST.MF,!META-INF/NOTICE.txt,!META-INF/LICENSE.txt)
-injars libs/OIAbout-lib-temporary.jar(!META-INF/MANIFEST.MF)
-injars libs/libGoogleAnalytics.jar(!META-INF/MANIFEST.MF)
-injars libs/xstream-1.3.1.jar(!META-INF/MANIFEST.MF)
-injars libs/ZQL_custom.jar(!META-INF/MANIFEST.MF)
-injars libs/xpp3_min-1.1.4c.jar(!META-INF/MANIFEST.MF)
-injars libs/GoogleAdMobAdsSdk-4.1.0.jar(!META-INF/MANIFEST.MF)
-injars libs/bugsense-trace.jar(!META-INF/MANIFEST.MF)
-outjars /tmp/android_1348923171424559204.jar
-libraryjars /opt/android-sdk/android-sdk-linux_x86-1.6_r1/platforms/android-12/android.jar(!org/xmlpull/v1/XmlPullParser.class,!org/xmlpull/v1/XmlPullParserException.class)
Note how XmlPullParser.class is filtered from the android API jar.
Don't worry about the warnings related to XmlPullParser just yet. Fix the errors and other warnings first, and if you must, use -ignorewarnings in your proguard.cfg.
I think your jar package include XmlPullParser class, and android.jar also include this.
So you can remove org.xmlpull.* classes in the jar package, and build again.
According to the partial log that you provide, the Android runtime class org.xmlpull.v1.XmlPullParser has ended up in your program code. You should make sure it is not present in bin/classes or in some jar in lib, because it is already present in the library jar android.jar.
Furthermore, you have 4247 duplicate class definitions. This is probably due to specifying "some -libraryjars" as you mention. I'm guessing these library jars are already included automatically by the build script, so you shouldn't specify them again.
The dependency already exist on your folder,
exclude it like below:
dependencies {
configurations {
all*.exclude group: 'xmlpull', module: 'xmlpull'
}
}
Sometimes it happens when you include one of your test libraries as a regular module dependency. For example don't do:
implementation 'com.android.support.test:runner:1.0.2' //wrong!!
do:
androidTestImplementation 'com.android.support.test:runner:1.0.2' //right (:
for me I could solve it by removing my previous modified build.gradle
I removed:
minifyEnabled true
shrinkResources true
and returned to the original setting
minifyEnabled false

Categories

Resources