Android proguard issues for release - android

I'm able to create builds for my android app, but when I turn on proguard i'm getting numerouos warnings, and then the build fails. The warnings are like the ones below:
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpEntity
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.params.HttpParams
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.conn.ClientConnectionManager
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.methods.HttpUriRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.methods.HttpUriRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpHost
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpHost
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpResponse
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.methods.HttpUriRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.ResponseHandler
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.methods.HttpUriRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.ResponseHandler
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpHost
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.ResponseHandler
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpHost
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.HttpRequest
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.client.ResponseHandler
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning: library class android.net.http.AndroidHttpClient depends on program class org.apache.http.entity.AbstractHttpEntity
It's complaining about libraries that were used in my project. My settings are below:
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFile file('proguard-rules.txt')
signingConfig signingConfigs.release
}
}
Within my proguard-rules.txt I have the following:
-libraryjars libs
All of my libraries are stored in the libs folder. Is there anything else i'm doing wrong?

inspect the jars , creating a packages list in libs you are using.
Then try adding following for those packages in the list in your proguard config file:
-dontwarn org.codehaus.jackson.**
...
-keep class org.codehaus.jackson.** { *; }

Your libraries contain duplicates of the android.http classes, which are already present in the Android runtime. This may cause conflicts. You should remove the duplicate libraries from your project.
See the ProGuard manual > Troubleshooting > Warning: library class ... depends on program class ...

Related

Proguard issues with Gradle 3.0.0

I'm trying to create an APK using ProGuard and the new Gradle 3.0.0 version. I'm getting a lot of warnings on classes that I thought I ignored in my ProGuard configuration file. The same configuration works well with Gradle 2.3.3 but seems to break on 3.0.0. The warnings are so many it's almost not reading the ProGuard configuration at all.
My build.gradle
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}
}
android{
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
signingConfig signingConfigs.release
lintOptions {
disable 'MissingTranslation'
}
}
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
Proguard warning below.
Warning: library class android.animation.FloatArrayEvaluator extends or implements program class android.animation.TypeEvaluator
Warning: library class android.animation.IntArrayEvaluator extends or implements program class android.animation.TypeEvaluator
Warning: library class android.animation.PointFEvaluator extends or implements program class android.animation.TypeEvaluator
Warning: library class android.animation.RectEvaluator extends or implements program class android.animation.TypeEvaluator
Warning: library class android.app.ActivityManager$TaskDescription extends or implements program class android.os.Parcelable
Warning: library class android.app.AlarmManager$AlarmClockInfo extends or implements program class android.os.Parcelable
Warning: library class android.app.AuthenticationRequiredException extends or implements program class android.os.Parcelable
Warning: library class android.app.AutomaticZenRule extends or implements program class android.os.Parcelable
Warning: library class android.app.Notification$Action extends or implements program class android.os.Parcelable
Warning: library class android.app.Notification$DecoratedCustomViewStyle extends or implements program class android.app.Notification$Style
Warning: library class android.app.Notification$MediaStyle extends or implements program class android.app.Notification$Style
Warning: library class android.app.Notification$MessagingStyle extends or implements program class android.app.Notification$Style
Warning: library class android.app.NotificationChannel extends or implements program class android.os.Parcelable
Warning: library class android.app.NotificationChannelGroup extends or implements program class android.os.Parcelable
Warning: library class android.app.NotificationManager$Policy extends or implements program class android.os.Parcelable
Warning: library class android.app.PictureInPictureParams extends or implements program class android.os.Parcelable
Warning: library class android.app.Presentation extends or implements program class android.app.Dialog
Warning: library class android.app.RemoteAction extends or implements program class android.os.Parcelable
Warning: library class android.app.RemoteInput extends or implements program class android.os.Parcelable
Warning: library class android.app.VoiceInteractor$PickOptionRequest$Option extends or implements program class android.os.Parcelable
Warning: library class android.app.VoiceInteractor$Prompt extends or implements program class android.os.Parcelable
Warning: library class android.app.WallpaperColors extends or implements program class android.os.Parcelable
Warning: library class android.app.admin.ConnectEvent extends or implements program class android.os.Parcelable
Warning: library class android.app.admin.DeviceAdminService extends or implements program class android.app.Service
Warning: library class android.app.admin.DnsEvent extends or implements program class android.os.Parcelable
Warning: library class android.app.admin.NetworkEvent extends or implements program class android.os.Parcelable
Warning: library class android.app.admin.SecurityLog$SecurityEvent extends or implements program class android.os.Parcelable
Warning: library class android.app.admin.SystemUpdateInfo extends or implements program class android.os.Parcelable
Warning: library class android.app.admin.SystemUpdatePolicy extends or implements program class android.os.Parcelable
Warning: library class android.app.assist.AssistContent extends or implements program class android.os.Parcelable
Warning: library class android.app.assist.AssistStructure extends or implements program class android.os.Parcelable
Warning: library class android.app.job.JobInfo extends or implements program class android.os.Parcelable
Warning: library class android.util.FloatProperty extends or implements program class android.util.Property
Warning: library class android.util.IntProperty extends or implements program class android.util.Property
Warning: library class android.view.ActionMode$Callback2 extends or implements program class android.view.ActionMode$Callback
Warning: library class android.view.Display$HdrCapabilities extends or implements program class android.os.Parcelable
Warning: library class android.view.Display$Mode extends or implements program class android.os.Parcelable
Warning: library class android.view.DragAndDropPermissions extends or implements program class android.os.Parcelable
Warning: library class android.view.KeyboardShortcutGroup extends or implements program class android.os.Parcelable
Warning: library class android.view.KeyboardShortcutInfo extends or implements program class android.os.Parcelable
Warning: library class android.view.PointerIcon extends or implements program class android.os.Parcelable
Warning: library class android.view.WindowAnimationFrameStats extends or implements program class android.os.Parcelable
Warning: library class android.view.WindowContentFrameStats extends or implements program class android.os.Parcelable
Warning: library class android.view.WindowId extends or implements program class android.os.Parcelable
Warning: library class android.view.accessibility.AccessibilityWindowInfo extends or implements program class android.os.Parcelable
Warning: library class android.view.animation.BaseInterpolator extends or implements program class android.view.animation.Interpolator
Warning: library class android.view.autofill.AutofillId extends or implements program class android.os.Parcelable
Warning: library class android.view.autofill.AutofillValue extends or implements program class android.os.Parcelable
Warning: library class android.view.inputmethod.CursorAnchorInfo extends or implements program class android.os.Parcelable
Warning: library class android.view.inputmethod.InputContentInfo extends or implements program class android.os.Parcelable
Warning: library class android.widget.ActionMenuView extends or implements program class android.widget.LinearLayout
Warning: library class android.widget.ActionMenuView$LayoutParams extends or implements program class android.widget.LinearLayout$LayoutParams
Warning: library class android.app.RemoteInput depends on program class android.content.Intent
Warning: library class android.app.RemoteInput depends on program class android.os.Bundle
Warning: library class android.app.RemoteInput depends on program class android.content.Intent
Warning: library class android.app.RemoteInput depends on program class android.os.Parcel
Warning: library class android.app.RemoteInput$Builder depends on program class android.os.Bundle
Warning: library class android.app.RemoteInput$Builder depends on program class android.os.Bundle
Warning: library class android.app.SharedElementCallback depends on program class android.view.View
Warning: library class android.app.SharedElementCallback depends on program class android.graphics.Matrix
Warning: library class android.app.SharedElementCallback depends on program class android.graphics.RectF
Warning: library class android.app.SharedElementCallback depends on program class android.os.Parcelable
Warning: library class android.app.SharedElementCallback depends on program class android.content.Context
Warning: library class android.media.session.MediaController$TransportControls depends on program class android.net.Uri
Warning: library class android.media.session.MediaController$TransportControls depends on program class android.os.Bundle
Warning: library class android.media.session.MediaController$TransportControls depends on program class android.os.Bundle
Warning: library class android.media.session.MediaController$TransportControls depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession depends on program class android.content.Context
Warning: library class android.media.session.MediaSession depends on program class android.os.Handler
Warning: library class android.media.session.MediaSession depends on program class android.app.PendingIntent
Warning: library class android.media.session.MediaSession depends on program class android.app.PendingIntent
Warning: library class android.media.session.MediaSession depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.ResultReceiver
Warning: library class android.media.session.MediaSession$Callback depends on program class android.content.Intent
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.net.Uri
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.net.Uri
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$Callback depends on program class android.os.Bundle
Warning: library class android.media.session.MediaSession$QueueItem depends on program class android.os.Parcelable$Creator
Warning: library class android.media.session.MediaSession$QueueItem depends on program class android.os.Parcel
Warning: library class android.media.session.MediaSession$Token depends on program class android.os.Parcelable$Creator
Warning: library class android.media.session.MediaSession$Token depends on program class android.os.Parcel
Warning: library class android.media.session.PlaybackState depends on program class android.os.Parcelable$Creator
Warning: library class android.media.session.PlaybackState depends on program class android.os.Parcel
Warning: library class android.media.session.PlaybackState depends on program class android.os.Bundle
Warning: library class android.media.session.PlaybackState$Builder depends on program class android.os.Bundle
Warning: library class android.media.session.PlaybackState$CustomAction depends on program class android.os.Parcelable$Creator
Warning: library class android.media.session.PlaybackState$CustomAction depends on program class android.os.Parcel
Warning: library class android.media.session.PlaybackState$CustomAction depends on program class android.os.Bundle
Warning: library class android.media.session.PlaybackState$CustomAction$Builder depends on program class android.os.Bundle
Warning: library class android.net.Network depends on program class android.os.Parcelable$Creator
Warning: library class android.net.Network depends on program class android.os.Parcel
Warning: library class android.os.LocaleList depends on program class android.os.Parcelable$Creator
Warning: library class android.os.LocaleList depends on program class android.os.Parcel
Warning: library class android.os.PersistableBundle depends on program class android.os.Parcelable$Creator
Warning: library class android.os.PersistableBundle depends on program class android.os.Parcel
Warning: library class android.os.UserManager depends on program class android.os.Bundle
Warning: library class android.os.UserManager depends on program class android.os.Bundle
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.content.Context
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.content.ContentResolver
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.graphics.Point
Warning: library class android.provider.DocumentsContract depends on program class android.os.CancellationSignal
Warning: library class android.provider.DocumentsContract depends on program class android.graphics.Bitmap
Warning: library class android.provider.DocumentsContract depends on program class android.content.ContentResolver
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.content.ContentResolver
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.content.ContentResolver
Warning: library class android.provider.DocumentsContract depends on program class android.net.Uri
Warning: library class android.provider.DocumentsContract depends on program class android.content.ContentResolver
Warning: library class android.security.KeyPairGeneratorSpec depends on program class android.content.Context
Warning: library class android.security.KeyPairGeneratorSpec$Builder depends on program class android.content.Context
Warning: library class android.service.media.MediaBrowserService depends on program class android.content.Intent
Warning: library class android.service.media.MediaBrowserService depends on program class android.os.IBinder
Warning: library class android.service.media.MediaBrowserService depends on program class android.os.Bundle
Warning: library class android.service.media.MediaBrowserService depends on program class android.os.Bundle
Warning: library class android.service.media.MediaBrowserService depends on program class android.os.Bundle
Warning: library class android.service.media.MediaBrowserService depends on program class android.os.Bundle
Warning: library class android.service.media.MediaBrowserService$BrowserRoot depends on program class android.os.Bundle
Warning: library class android.service.media.MediaBrowserService$BrowserRoot depends on program class android.os.Bundle
Warning: library class android.widget.Toolbar depends on program class android.util.AttributeSet
Warning: library class android.widget.Toolbar depends on program class android.graphics.drawable.Drawable
Warning: library class android.widget.Toolbar depends on program class android.graphics.drawable.Drawable
Warning: library class android.widget.Toolbar depends on program class android.content.Context
Warning: library class android.widget.Toolbar depends on program class android.content.Context
Warning: library class android.widget.Toolbar depends on program class android.graphics.drawable.Drawable
Warning: library class android.widget.Toolbar depends on program class android.graphics.drawable.Drawable
Warning: library class android.widget.Toolbar depends on program class android.view.View$OnClickListener
Warning: library class android.widget.Toolbar depends on program class android.view.Menu
Warning: library class android.widget.Toolbar depends on program class android.graphics.drawable.Drawable
Warning: library class android.widget.Toolbar depends on program class android.graphics.drawable.Drawable
Warning: library class android.widget.Toolbar depends on program class android.os.Parcelable
Warning: library class android.widget.Toolbar depends on program class android.os.Parcelable
Warning: library class android.widget.Toolbar depends on program class android.view.MotionEvent
Warning: library class android.widget.Toolbar depends on program class android.util.AttributeSet
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams
Warning: library class android.widget.Toolbar depends on program class android.util.AttributeSet
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams
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 21 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)
Warning: there were 928 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 53 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)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:transformClassesAndResourcesWithProguardForCouchdbRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesAndResourcesWithProguardForCouchdbRelease'.
> Job failed, see logs for details
I've upgraded to gradle 3.0.1 and most of the warnings are gone. If you're still on 3.0.0 then use this in your proguard file
-dontwarn android.**
Not ideal but gets it working.
I had the same issue, although my case is kind of unique, here is my solution:
After upgrading to the new 3.0.1 version (com.android.tools.build:gradle:3.0.1), I saw fewer warnings (originally I had >3000 warnings).
The source of my problem was that I used a library which had a dependency on the whole android framework (This one: https://github.com/tony19/logback-android, the issue #73).
I also looked into the dependencies (./gradlew app:dependenices), because I had libraries which depends on the old apache http client, which also causes some warnings. I had to eliminate them as well.
It may help you
Enabling ProGuard for local library modules no longer affects the library's code. Instead, you should run ProGuard on the app module that consumes the library.
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

Proguard causing error while building release apk

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

Android-Studio-1.2.RC Proguard warnings on Square's Okio library reference

WIth Android Studio: 1.2.RC
I enabled proguard in .gradle:
```
minifyEnabled=true
and added these rules to my proguard-rules.pro:
-dontwarn com.squareup.**
-dontwarn okio.**
and added these lint rules to my .gradle file:
warningsAsErrors false
abortOnError false
disable 'InvalidPackage'
```
But I still get these warning when I try to run the app in debug mode:
```
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: there were 14 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)
:app:proguardDebug FAILED
```
It's so weird since I also added these rules/options to all my library modules that depend on OkHttp/Picasso, I don't know where went wrong, perhaps this is a Android Studio bug ? Does anyone have any clues to this problem ?
I have opened an issue on github.
You've disable warnings for
-dontwarn com.squareup.**
-dontwarn okio.**
But what about for packages (as seen in your posted log)
-dontwarn org.codehaus
-dontwarn java.nio
Either way, ignoring warnings is not a good approach.
Try keeping these classes from being minified like so:
-keep public class org.codehaus.**
-keep public class java.nio.**
Oh Christ, I forgot to specify the proguard file for my debug build, adding the 'proguardFiles' rule would solve the problem:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix ".debug"
}
}
One of those moments you searched hard for your keys and it's right in your pocket.

Android - Proguard with httpcore and httpmime using Android Studio and Gradle

I'm developing an app with Android Studio 1.0.2 and Gradle 1.0.0 using the Apache libraries httpmime and httpcore for multipart entities. Here's my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
// Something wrong with the http* libs
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
defaultConfig {
// ...
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-v4:21.0.2"
compile 'org.apache.httpcomponents:httpcore:4.3.2'
compile 'org.apache.httpcomponents:httpmime:4.3.5'
compile 'net.hockeyapp.android:HockeySDK:3.5.0'
}
The app itself and the 'normal' release APKs work fine, but when I'm trying to use ProGuard I get the following error message:
Note: there were 157 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning:library class org.apache.http.auth.AuthenticationException extends or implements program class org.apache.http.ProtocolException
Warning:library class org.apache.http.auth.MalformedChallengeException extends or implements program class org.apache.http.ProtocolException
Warning:library class org.apache.http.auth.params.AuthParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean
Warning:library class org.apache.http.client.NonRepeatableRequestException extends or implements program class org.apache.http.ProtocolException
Warning:library class org.apache.http.client.RedirectException extends or implements program class org.apache.http.ProtocolException
Warning:library class org.apache.http.client.entity.UrlEncodedFormEntity extends or implements program class org.apache.http.entity.StringEntity
Warning:library class org.apache.http.client.methods.HttpEntityEnclosingRequestBase extends or implements program class org.apache.http.HttpEntityEnclosingRequest
Warning:library class org.apache.http.client.methods.HttpRequestBase extends or implements program class org.apache.http.message.AbstractHttpMessage
Warning:library class org.apache.http.client.methods.HttpUriRequest extends or implements program class org.apache.http.HttpRequest
Warning:library class org.apache.http.client.params.AllClientPNames extends or implements program class org.apache.http.params.CoreConnectionPNames
Warning:library class org.apache.http.client.params.AllClientPNames extends or implements program class org.apache.http.params.CoreProtocolPNames
Warning:library class org.apache.http.client.params.ClientParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean
Warning:library class org.apache.http.client.protocol.RequestAddCookies extends or implements program class org.apache.http.HttpRequestInterceptor
Warning:library class org.apache.http.client.protocol.RequestDefaultHeaders extends or implements program class org.apache.http.HttpRequestInterceptor
Warning:library class org.apache.http.client.protocol.RequestProxyAuthentication extends or implements program class org.apache.http.HttpRequestInterceptor
Warning:library class org.apache.http.client.protocol.RequestTargetAuthentication extends or implements program class org.apache.http.HttpRequestInterceptor
Warning:library class org.apache.http.client.protocol.ResponseProcessCookies extends or implements program class org.apache.http.HttpResponseInterceptor
Warning:library class org.apache.http.conn.BasicManagedEntity extends or implements program class org.apache.http.entity.HttpEntityWrapper
Warning:library class org.apache.http.conn.ManagedClientConnection extends or implements program class org.apache.http.HttpClientConnection
Warning:library class org.apache.http.conn.ManagedClientConnection extends or implements program class org.apache.http.HttpInetConnection
Warning:library class org.apache.http.conn.OperatedClientConnection extends or implements program class org.apache.http.HttpClientConnection
Warning:library class org.apache.http.conn.OperatedClientConnection extends or implements program class org.apache.http.HttpInetConnection
Warning:library class org.apache.http.conn.params.ConnConnectionParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean
Warning:library class org.apache.http.conn.params.ConnManagerParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean
Warning:library class org.apache.http.conn.params.ConnRouteParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean
Warning:library class org.apache.http.cookie.MalformedCookieException extends or implements program class org.apache.http.ProtocolException
Warning:library class org.apache.http.cookie.params.CookieSpecParamBean extends or implements program class org.apache.http.params.HttpAbstractParamBean
Warning:library class org.apache.http.impl.client.ClientParamsStack extends or implements program class org.apache.http.params.AbstractHttpParams
Warning:library class org.apache.http.impl.client.EntityEnclosingRequestWrapper extends or implements program class org.apache.http.HttpEntityEnclosingRequest
Warning:library class org.apache.http.impl.client.RequestWrapper extends or implements program class org.apache.http.message.AbstractHttpMessage
Warning:library class org.apache.http.impl.client.TunnelRefusedException extends or implements program class org.apache.http.HttpException
Warning:library class org.apache.http.impl.conn.DefaultClientConnection extends or implements program class org.apache.http.impl.SocketHttpClientConnection
Warning:library class org.apache.http.impl.conn.DefaultResponseParser extends or implements program class org.apache.http.impl.io.AbstractMessageParser
Warning:library class org.apache.http.impl.conn.LoggingSessionInputBuffer extends or implements program class org.apache.http.io.SessionInputBuffer
Warning:library class org.apache.http.impl.conn.LoggingSessionOutputBuffer extends or implements program class org.apache.http.io.SessionOutputBuffer
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.client.HttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.client.methods.HttpEntityEnclosingRequestBase depends on program class org.apache.http.HttpEntity
Warning:library class org.apache.http.client.methods.HttpRequestBase depends on program class org.apache.http.ProtocolVersion
Warning:library class org.apache.http.client.methods.HttpRequestBase depends on program class org.apache.http.RequestLine
Warning:library class org.apache.http.conn.scheme.PlainSocketFactory depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.conn.scheme.SchemeRegistry depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.conn.scheme.SocketFactory depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpRequestExecutor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.ConnectionReuseStrategy
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.BasicHttpProcessor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpRequestExecutor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.ConnectionReuseStrategy
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.BasicHttpProcessor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpResponseInterceptor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpRequestInterceptor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpResponse
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpRequestExecutor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.ConnectionReuseStrategy
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpProcessor
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpHost
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.HttpRequest
Warning:library class org.apache.http.impl.client.AbstractHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program class org.apache.http.protocol.HttpRequestExecutor
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program class org.apache.http.ConnectionReuseStrategy
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program class org.apache.http.protocol.BasicHttpProcessor
Warning:library class org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager depends on program class org.apache.http.params.HttpParams
Warning:there were 109 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)
:app:proguardRelease FAILED
Error:Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.
According to the links given in the error message about the duplicate class definitions and library classes depending on program classes I should use something like -injars ... or -libraryjars ... in my proguard-rules.pro. But since I use the remote libraries and not the .jar files I don't know how to use these proguard options.
So I googled for a solution for my problem and found several possibilities:
I downloaded the jars, added them to my \app\libs folder and added the options -libraryjar and/or -injar for both jars, but no combination would work: Either the files couldn't be found or read, or I got an error that one of the libs would be processed twice.
I also tried various combinations of -keep class org.apache.**, -keep interface org.apache.**, -keep public class org.apache.** {*;}, -keepnames class org.apache.** {*;} with or without the {*;} but none of them work.
I also tried the -dontwarn org.apache.** or -dontwarn org.apache.http.** option which gives me no errors during creating the APK, but when I try to establish an internet connection using the http* libs in the app, the app crashes with something like a NoSuchMethodException.
So my question is: is there a way using the remote libraries and proguard? Or is it at least possible by including the .jars in my \libs folder?
Thank you very much
Well i am using like this
-dontwarn org.apache.commons.**
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
Also i am compiling using jar inside my libs folder
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/httpclient-4.3.5.jar')
compile files('libs/httpclient-cache-4.3.5.jar')
compile files('libs/httpcore-4.3.2.jar')
instead of using from maven
Try This
-dontwarn org.apache.commons.**
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }

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