I updated my dex classes with amigo library (it's changing one apk for another apk with the same key and signature, all is working except JSOUP)
Error:
FATAL EXCEPTION: Thread-1567
Process: com.smedic.tubtub, PID: 26102
java.lang.ExceptionInInitializerError
at org.jsoup.nodes.Document$OutputSettings.(Document.java:372)
at org.jsoup.nodes.Document.(Document.java:19)
at org.jsoup.parser.TreeBuilder.initialiseParse(TreeBuilder.java:32)
at org.jsoup.parser.TreeBuilder.parse(TreeBuilder.java:42)
at org.jsoup.parser.HtmlTreeBuilder.parse(HtmlTreeBuilder.java:56)
at org.jsoup.parser.Parser.parseInput(Parser.java:32)
at org.jsoup.helper.DataUtil.parseByteData(DataUtil.java:104)
at org.jsoup.helper.HttpConnection$Response.parse(HttpConnection.java:666)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:225)
at com.power.mati.VideosAdapter$4.run(VideosAdapter.java:177)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalStateException: Could not read resource
entities-xhtml.properties. Make sure you copy resources for
org.jsoup.nodes.Entities
at org.jsoup.nodes.Entities.load(Entities.java:289)
at org.jsoup.nodes.Entities.access$000(Entities.java:25)
at org.jsoup.nodes.Entities$EscapeMode.(Entities.java:48)
Any idea how to fix it?
I am using jars and maven, same situation.
I saw something similar and my solution is in proguard
-keep class org.jsoup.**
Update the library, use this one :
implementation 'org.jsoup:jsoup:1.13.1'
Your problem will be resolved...
add Jsoup library in libs folder and add -keep class org.jsoup.** in your proguard-rules.pro file.
Then it will work.
in my case, my problem is solved by turning minifyEnabled to false in the app's build.gradle, this will keep all classes in the final release apk.
android {
....
buildTypes {
...
release {
minifyEnabled false
}
}
}
Related
I have enabled Proguard and configured the rules
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
For GSON I used these rules
added my models to exceptions (-keep class my.package.model.** { *; })
Also used other rules for various libraries
I have this error -> Registering an InstanceCreator with Gson for this type may fix this problem.
the error occurred when switching to kotlin 1.6.0 and 1.6.10.
There is no error on version Kotlin 1.5.21!
Error (I have a bug only on Kotlin 1.6.0/1.6.10. There is no error on kotlin 1.5.21) --->
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.project.main, PID: 2943
java.lang.RuntimeException: Unable to invoke no-args constructor for class com.project.main.domain.entity.MyEntityClass. Registering an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.c$e.a(SourceFile:228)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(SourceFile:212)
at com.google.gson.Gson.h(SourceFile:963)
at com.google.gson.Gson.j(SourceFile:928)
at com.google.gson.Gson.l(SourceFile:877)
at com.project.main.data.cache.converter.MyEntityClassConverter.toMyEntityClass(SourceFile:14)
at com.project.main.data.cache.dao.MyProjectDao_Impl$21.call(SourceFile:947)
at com.project.main.data.cache.dao.MyProjectDao_Impl$21.call(SourceFile:889)
at k1.c$a$a$a$a.invokeSuspend(SourceFile:128)
at uh.a.resumeWith(SourceFile:33)
at uk.z0.run(SourceFile:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.UnsupportedOperationException: Abstract class can't be instantiated! Class name: com.project.main.domain.entity.MyEntityClass
at com.google.gson.internal.l.a(SourceFile:120)
at com.google.gson.internal.l$a.c(SourceFile:49)
at com.google.gson.internal.c$e.a(SourceFile:225)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(SourceFile:212)
at com.google.gson.Gson.h(SourceFile:963)
at com.google.gson.Gson.j(SourceFile:928)
at com.google.gson.Gson.l(SourceFile:877)
at com.project.main.data.cache.converter.MyEntityClassConverter.toMyEntityClass(SourceFile:14)
at com.project.main.data.cache.dao.MyProjectDao_Impl$21.call(SourceFile:947)
at com.project.main.data.cache.dao.MyProjectDao_Impl$21.call(SourceFile:889)
at k1.c$a$a$a$a.invokeSuspend(SourceFile:128)
at uh.a.resumeWith(SourceFile:33)
at uk.z0.run(SourceFile:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
I have rules for this error.
-keep class com.project.main.domain.entity.MyEntityClass { ; }
but I'm adding the whole package
-keep class com.project.main.domain.entity.* { *; }
I also have all the other rules for GSON -> rules
#TypeConverter
fun toMyEntityClass(value: String): MyEntityClass =
gson.fromJson(value, object : TypeToken<MyEntityClass>() {}.type) //Error
I also tried to prescribe just one rule. The rule helps to run the project on 1.5.21 and works. But it doesn't work on 1.6.0 - 1.6.10. I don't want to create an Instance Creator. I have too many models and I will waste a lot of time.
-keep class ** { *; }
For any classes that interact with GSON you have to keep as follow :
-keep class "MODEL CLASSES"
for your issue you can do like :
-keep class com.project.main.domain.entity.** { *; }
It will keep all classes under the entity package.
The problem was solved by itself, after updating the libraries
gson 2.9.0
and kotlin 2.6.21
I didn't do anything, just updated to these versions
I haven't checked 1.6.0 and 1.6.10 works in tandem with gson 2.9.0 but gson didn't work with the previous release version
As a result, I upgraded Kotlin from 1.5.21 -> 1.6.21
I'm updating our project to use Gradle 4.1 and Android Gradle plugin 3.0.1. I have updated our dependency configuration to the new configuration and the project successfully compiles. However, there are lots of unresolved dependencies (incl. Kotlin standard library's top-level functions) when compiling android tests (assembleAndroidTest Gradle task). I was suspecting that Proguard might cause this (although it didn't before updating Gradle), but even adding explicit rules to keep symbols/classes doesn't help. We use Kotlin 1.2.10 and Kotlin-Kapt plugin.
I appreciate any help.
I don't use ProGuard for debug but the following answers seem useful.
I would revise your Gradle configuration another time following the migration guide, and first of all clean and invalidate caches.
Proguard
Chech this question and answers about how to use Kotlin with Proguard.
Disable these directives in your build.gradle file to discard Proguard.
minifyEnabled false
shrinkResources false
Configure Proguard for Kotlin.
You don't need to do anything special. Kotlin works with ProGuard out
of the box. But you may face some strange errors when processing your
application with ProGuard. In this case just add:
-dontwarn kotlin.**
You also can add:
-keep class kotlin.** { *; }
-keep class kotlin.Metadata { *; }
-dontwarn kotlin.**
-keepclassmembers class **$WhenMappings {
<fields>;
}
-keepclassmembers class kotlin.Metadata {
public <methods>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}
Check this related questions to either enable Proguard for tests or not:
proguard gradle debug build but not the tests
Specify the Proguard file to use on the instrumentation tests.
runProguard is old. It was replaced with minifyEnabled
With minifyEnabled (and other changes in new versions of Gradle) you
will may encounter issues where the Proguard config works for your
debug apk but not for the instrumentation tests. The apk created for
instrumentation tests will use its own proguard file, so changing your
existing proguard file will have no effect.
In this case, you need to specify the proguard file to use on the
instrumentation tests. It can be quite permissive because it's not
affecting your debug and release builds at all.
// inside android block
debug {
shrinkResources true // removes unused graphics etc
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testProguardFile('test-proguard-rules.pro')
}
Android Unit Tests with proguard enabled
Add a custom proguard rules file
/project/app/proguard-test-rules.pro
# Proguard rules that are applied to your test apk/code.
-ignorewarnings
-keepattributes *Annotation*
-dontnote junit.framework.**
-dontnote junit.runner.**
-dontwarn android.test.**
-dontwarn android.support.test.**
-dontwarn org.junit.**
-dontwarn org.hamcrest.**
-dontwarn com.squareup.javawriter.JavaWriter
# Uncomment this if you use Mockito
#-dontwarn org.mockito.**
The add the following to your build.gradle for your app. To use the proguard file when testing.
/project/app/build.gradle
android {
debug {
minifyEnabled true
testProguardFile 'proguard-test-rules.pro'
}
}
Add a buidType for testing
I've solved this problem in my build by having an additional "dev"
buildType where I enable proguard, but configure it to keep all code
in my own package, and a few specific library classes that happen to
be used from tests only. I also disable obfuscation in the dev
buildType so that it can be debugged from an IDE.
For debug and release builds I use my "real" proguard settings
including obfuscation and optimizations.
Use separate test modules
Separate test modules are now variant-aware. This means that
specifying targetVariant is no longer necessary.
Each variant in the test module will attempt to test a matching
variant in the target project. By default, test modules contain only a
debug variant, but you can create new build types and new flavors to
create new variants to match the tested app project. A connectedCheck
task is created for each variant.
To make the test module test a different build type only, and not the
debug one, use VariantFilter to disable the debug variant in the test
project, as shown below:
android {
variantFilter { variant ->
if (variant.buildType.name.equals('debug')) {
variant.setIgnore(true);
}
}
}
If you want a test module to target only certain flavors or build
types of an app, you can use the matchingFallbacks property to target
only the variants you want to test. This also prevents the test module
from having to configure those variants for itself.
Gradle
Revise your Gradle configuration. In order to to build an Android project written in Kotlin:
Set up the kotlin-android gradle plugin and apply it to your project.
Add kotlin-stdlib dependencies.
Those actions may also be performed automatically in IntelliJ IDEA /
AS by invoking the action:
Tools | Kotlin | Configure Kotlin in Project
kotlin-android
buildscript {
ext.kotlin_version = '1.2.10'
...
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
kotlin-stdlib
Don't forget to configure the standard library dependency:
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib"
}
Revise your dependencies configuration using the migration
guide.
Note: compile, provided, and apk are currently still available.
However, they will be removed in the next major release of
the Android plugin.
Provide version manually
Starting with Kotlin 1.1.2, the dependencies with group
org.jetbrains.kotlin are by default resolved with the version taken
from the applied plugin.
You can provide the version manually using the full dependency
notation like this:
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Resolution strategy
You also can force the resolution strategy:
configurations.all {
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
}
As you are using Android Gradle plugin 3.0.1:
// Instead, because the new build model delays dependency resolution, you
// should query and modify the resolution strategy using the Variant API:
android {
applicationVariants.all { variant ->
variant.getCompileConfiguration().resolutionStrategy {
...
}
variant.runtimeConfiguration.resolutionStrategy {
...
}
variant.getAnnotationProcessorConfiguration().resolutionStrategy {
...
}
}
}
Exclude app dependencies from test configurations using the Variant API:
On previous versions of the Android plugin, you could exclude certain
transitive dependencies of your app from your tests using the exclude
keyword. However, with the new dependency configurations, you must do
it at execution time using the Variant API:
android.testVariants.all { variant ->
variant.getCompileConfiguration().exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
variant.getRuntimeConfiguration().exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp'
}
Extended versions of the Kotlin standard library
If you're targeting JDK 7 or JDK 8, you can use extended versions of
the Kotlin standard library which contain additional extension
functions for APIs added in new JDK versions. Instead of
kotlin-stdlib, use one of the following dependencies:
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
In Kotlin 1.1.x, use kotlin-stdlib-jre7 and kotlin-stdlib-jre8
instead.
Kotlin reflection
If your project uses Kotlin
reflection
or testing facilities, you need to add the corresponding dependencies
as well:
compile "org.jetbrains.kotlin:kotlin-reflect"
testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit"
Kapt
See the description of Kotlin annotation processing tool (kapt).
Apply the kotlin-kapt Gradle plugin:
apply plugin: 'kotlin-kapt'
App crashes when i apply crashlytics on it
FATAL EXCEPTION: main
Process: com.ehs.pk, PID: 20963
java.lang.RuntimeException: Unable to get provider com.crashlytics.android.CrashlyticsInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.CrashlyticsInitProvider" on path: DexPathList[[zip file "/data/app/com.ehs.pk-8.apk"],nativeLibraryDirectories=[/data/app-lib/com.ehs.pk-8, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4993)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4585)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499)
at android.app.ActivityThread.access$1500(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.crashlytics.android.CrashlyticsInitProvider" on path: DexPathList[[zip file "/data/app/com.ehs.pk-8.apk"],nativeLibraryDirectories=[/data/app-lib/com.ehs.pk-8, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:4978)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4585)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4499)
at android.app.ActivityThread.access$1500(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
I was facing the same issue, is related to the 64k limit "multidex".
I was using multiDexEnabled true property in build.gradle in defaultConfig block, under android one.
As stated in Google documentation
for devices with Android API prior to 21, we need to include the multidex library (implementation 'com.android.support:multidex:1.0.2')
and extend MultiDexApplication in our Application class
I have solved this problem by doing the following:
In the Application class:
#Override
public void attachBaseContext(Context base) {
super.attachBaseContext(base);
try {
MultiDex.install(this);
} catch (RuntimeException multiDexException) {
multiDexException.printStackTrace();
}
}
We were having the same issue, and disabling instant run in Android Studio seemed to get it working.
On mac
Android Studio Settings or Preferences -> Build,Execution,Deployment -> Instant Run.
By looking at this part...
Didn't find class ... on path: DexPathList ... dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
of the stack trace you can figure out that your test device is probably pre-Lollipop (Android 5.0) and that you just hit the 64k limit. You can fix it as described here.
This could be an issue with Instant Run. Turn off the Instant Run and run the build again. I faced the same issue and it resolved it.
When minifyEnabled is true while using firebase or crashlytics this problem may happens. Enabling minifyEnabled shrinks methods and classes names to lowest possible characters (changing names and that raises ClassNotFoundException). Unfortunately, firebase and crashlytics versions had many problem with that. To solve it just tell proguard to not shrink those classes by writing the next lines in proguard file "proguard-rules.pro" as:
-keep class com.crashlytics.** { *; }
-keep class com.google.firebase.*.* { *; }
Now if the problem not go away or it didn't find other classes like yours, then check your base project build.gradle dependencies version of gradle and others. I found these version is free of that error:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.1'
}
Remeber you can put any classes path into that proguard file so it did not change its name or methods when minify is enabled, and that will help you with other classes "ClassNotFoundException" as well.
Also to test this in debugging, you can adjust debug setting in build.gradle as:
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Just one more case:
In my case, I disabled instant run, added multiDexEnabled true in my gradle, and added the 'com.android.support:multidex:1.0.3' to my dependencies, called the MultiDex.install(this); directly in my custom application, but I still got the same error. The error only occurs in the system Android 4.4. Everything works well on Android 7.0 and 9.0.
Finally, moving the MultiDex.install(this); from the onCreate(Context) method to the attachBaseContext(Context) solved my problem.
So, you should call MultiDex.install(this); in attachBaseContext(Context) instead of onCreate(Context) when you don't plan to extend the MultiDexApplication directly.
If this happens when you run with minifyEnabled true, add this rule in your proguard-rules.pro file:
-keep public class com.crashlytics.android.CrashlyticsInitProvider
I want to enable ProGuard in library module but getting compilation error that package does not exists. Why package not exists after apply ProGuard in library module?
library module build.gradle
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Log Error
/home/hitesh/Documents/Android Studio Project/ALPR-Sample/app/src/main/java/com/alpr/sample/GalleryActivity.java
Error:(15, 32) error: package com.alprlib.alpr.doc does not exist
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
here doc class file exist in library module
ProGuard file rules
-keep class com.alprlib.alpr.** { *; }
-keepclassmembers class alprlib.alpr.** {*;}
It makes sense to me to specify proguard settings for a library (like which library files shouldn't be obfuscated) in the library project. I've found that I also need to include proguard configurations from my library modules in my application. To do this, I added the following to the defaultConfig section in my library's build.gradle
consumerProguardFiles 'proguard-rules.pro'
and then configured the proguard-rules.pro file in my library module to keep the names of important serialized classes.
See also consumerProguardFiles
Please see this post:
https://stackoverflow.com/a/48636288/8770663
you can write on your proguard file -
-keep public class * extends android.app.Activity
Or what ever class you want to keep.
Have a look on this - https://www.guardsquare.com/en/proguard/manual/examples
My project compiles and executes well on debug mode but when i try to generate a signed apk, errors arise. This appears on the message log:
:app:proguardRelease
Warning:android.support.v4.app.DialogFragment: can't find referenced class android.support.v4.app.DialogFragment$DialogStyle
Warning:android.support.v4.app.FragmentTransaction: can't find referenced class android.support.v4.app.FragmentTransaction$Transit
Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ResolvedLayoutDirectionMode
Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$LayoutDirectionMode
Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$LayerType
Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$AccessibilityLiveRegion
Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$ImportantForAccessibility
Warning:android.support.v4.view.ViewCompat: can't find referenced class android.support.v4.view.ViewCompat$OverScroll
Warning:android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$EdgeGravity
Warning:android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$LockMode
Warning:android.support.v4.widget.DrawerLayout: can't find referenced class android.support.v4.widget.DrawerLayout$State
Warning:there were 11 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)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
:app:dexRelease UP-TO-DATE
:app:crashlyticsStoreDeobsRelease
:app:crashlyticsUploadDeobsRelease
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of /home/kombo/RAL/Mpasho/app/build/intermediates/classes-proguard/release/classes.jar
I have tried every possible way of remedying this by updating my build tools, using the latest gradle version, checking all the dependencies and the error still shows up.
I am pretty sure the v4 support library is present in the project since no errors arise in debug mode.
I also had this issue when upgrading everything that is built related to 23 (Android Libraries, SDK etc).
This proguard configuration fixed it for me:
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn com.google.android.gms.**
-dontwarn com.android.volley.toolbox.**
Source
Turns out I had omitted the getDefaultProguardFile('proguard-android.txt') line on the proguard files and was just using proguard-rules.pro
added these two line in progaurd
-dontwarn android.net.http.AndroidHttpClient
-dontwarn com.google.android.gms.**
and it works..
It is related to library used in project.
The default ProGuard file already has a rule to ignore support library warnings. If you don't have it you can add to your file
-dontwarn android.support.**
but would be better to add the default one. See Proguard configuration#Android Developers
This also could happen due to errors/warnings related to included .jar files
Check in build output for proguard warnings/errors.
I had issue related to opencsv jar file. Hint by Lakedaemon in above comment helped me and its solved.
Try to look up in the whole error message. It may contain info that you include a library twice. This was the problem in my case and it was fixed after removing duplicated includes.
Try add this code in your proguard-rules.pro:
-ignorewarnings
It solved my problem.
I think your app build.gradle buildTypes > release > minifyEnabled is true
That cause you get this error message.
Avoid this error message, set buildTypes > release > minifyEnabled is false
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}