ClassNotFoundException "android.support.v4.graphics.drawable.DrawableWrapper" - android

What can cause this error for class DrawableWrapper from the support lib?
Caused by: java.lang.ClassNotFoundException: Didn't find class
"android.support.v4.graphics.drawable.DrawableWrapper" on path:
DexPathList[[zip file "/data/app/com.example.banyan.tasty-
1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Try updating your support library to 27.1.0.

Make sure all of your "com.android.support:*" dependencies are at the same version.
Looks like one of the support libraries uses something that is missing in the other one.

i fixed same error updating version
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
To
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'

I started getting this exception in Android 5 and Android 4 users after removing com.android.support-v13 from my build.gradle file:
configurations.all {
exclude group: 'com.android.support', module: 'support-v13'
}
I removed the above exclude configuration and no longer saw this crash.

In my case, I used support library version '27.0.2' for my project. It was working perfectly. However, when I copy & paste the project to different location and I opened in Android studio. That time, android studio added below line in build.gradle (path: MyProject/app/build.gradle)
compile 'com.android.support:support-v4:27.1.1'
Then I got the below exception.
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.graphics.drawable.DrawableWrapper" on path: DexPathList
I removed the line from build.gradle (MyProject/app/build.gradle). Now it is working fine.

Try this:
import android.support.v7.graphics.drawable.DrawableWrapper;

import android.support.v7.graphics.drawable.DrawableWrapper;
or
import android.support.v4.graphics.drawable.WrappedDrawable; will help.
Also, when you use Drawable inner = ((WrappedDrawable) drawable).getWrappedDrawable();, you can add #SuppressLint("RestrictedApi") above your method.

Try:
enable D8
if you using
AS 3.1

Related

Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules

Just started this error on Android build. Please help.
"Duplicate class com.google.android.gms.internal.firebase_messaging.zza found in modules jetified-firebase-iid-19.0.0-runtime.jar (com.google.firebase:firebase-iid:19.0.0) and jetified-firebase-messaging-22.0.0-runtime.jar (com.google.firebase:firebase-messaging:22.0.0)"
In build.gradle:
implementation "com.google.firebase:firebase-iid:21.1.0"
None of the answers above is correct. And none of them solves the problem.
The problem is in transitive dependencies.
You need to check which libs are causing the issue and do something like:
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation ('com.google.firebase:firebase-iid:21.1.0') {
transitive = true
}
I resolved this problem by using the Firebase Android BoM
In my case the problem depends on the coexistence of messaging and functions.
So from this:
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.firebase:firebase-functions-ktx:20.0.0'
To this:
implementation platform('com.google.firebase:firebase-bom:28.2.1')
implementation 'com.google.firebase:firebase-functions-ktx'
implementation 'com.google.firebase:firebase-messaging'
BOM 31.x does have currently this problem.
See issue here:
https://github.com/firebase/firebase-android-sdk/issues/4206
Resolved via issue here but not yet official released:
https://github.com/firebase/firebase-android-sdk/pull/4225
Comment:
it was not resolved yet, 31.0.1 only contained a fix to crashlytics crash bug. That's why this issue is still open. The team here will make a fix close the issue, then do a release likely with release notes indicating it is fixed, when it is fixed https://firebase.google.com/support/release-notes/android - here
A current workaround is to add the iid version explicitly until a new BOM version is released:
implementation platform('com.google.firebase:firebase-bom:31.0.0')
implementation 'com.google.firebase:firebase-functions'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-iid:21.1.0'
I encountered the same problem.
I fixed it by redefining my dependencies implementations like this:
In build.gradle:
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
Please note my configuration in buildscript: com.android.tools.build:gradle:4.2.1
Then, clean and rebuild project.
Can you share more information about your setup?
Using react-native-push-notification ^3.1.9, I've got the same error.
To fix it :
in project/build.gradle:
buildscript {
ext {
googlePlayServicesVersion = "17.0.0"
firebaseMessagingVersion = "20.1.0"
firebaseVersion = "20.1.0"
// other settings
}
// other settings
}
in project/app/build.gradle:
dependencies {
implementation "com.google.firebase:firebase-messaging:20.1.0"
// other implementations
}
The reason : react-native-push-notification package specify dependency to firebase-messaging:+ : which ask to get the last version.
So, gradle upload the latest com.google.firebase:firebase-messaging:22.x.x which declare already existing classes in firebase-iid.
If you don't want to use firebase-bom because you don't trust firebase to keep all the proper versions in check then you can remove the duplicate.
Run ./gradlew app:dependencies (or replace app with your module)
Search for iid:19.0.0 (or whatever version is giving you issues)
Scroll up in the list to see where the library originates from.
You should see something like \--- com.google.firebase:firebase-iid:19.0.0
Keep scrolling until you find the dependency and module it originates in, marked with a + eg (+--- com.google.firebase:firebase-ml-vision)
Locate the dependency in your project and remove the duplicate iid
api("com.google.firebase:firebase-ml-vision:$version") {
exclude group: 'com.google.firebase', module: 'firebase-iid'
}

java.lang.ClassNotFoundException: Didn't find class "io.ktor.client.HttpClientJvmKt"

I have create kotlin multiplatform project for handling API.
I integrated this in my main project but I am getting following exception.
java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/HttpClientJvmKt;
I tried to add following dependencies in my main project still issue persists.
dependencies {
implementation "io.ktor:ktor-client-core:1.3.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:0.20.0"
}
packagingOptions {
exclude 'META-INF/kotlinx-io.kotlin_module'
exclude 'META-INF/atomicfu.kotlin_module'
exclude 'META-INF/kotlinx-coroutines-io.kotlin_module'
exclude 'META-INF/kotlinx-coroutines-core.kotlin_module'
}
Still I am getting this issue.
Any help would be appreciated.
In MPP you need to declare dependencies for each target.
For example:
commonMain needs to have the dependency you used above:
implementation "io.ktor:ktor-client-core:1.3.2"
androidMain needs to have it's own dependency:
implementation "io.ktor:ktor-client-okhttp:1.3.2"
iosMain also needs it's own dependency:
implementation "io.ktor:ktor-client-ios:1.3.2"
Note the suffix of ktor-client-xxxx.
So my guess is, you only need to replace the dependency in your main project to io.ktor:ktor-client-okhttp (or whichever client you prefer)

Latest version of Glide giving dependency error

I have upgraded the version of Glide from 4.0.0-RC0 to 4.4.0. But it is giving me an error saying
Error:Module 'com.github.bumptech.glide:glide:4.4.0' depends on one or more Android Libraries but is a jar
It is not saying which jar or any other information.
Does anybody know how to fix this? I am also attaching the entries for Glide in my build.gradle
compile 'com.github.bumptech.glide:glide:4.4.0'
compile 'com.github.bumptech.glide:okhttp3-integration:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
compile 'com.github.bumptech.glide:annotations:4.4.0'
EDIT : I am using the support library version 27.0.1
I faced the same issue, but using this solved it :
compile('com.github.bumptech.glide:glide:4.4.0#aar') {
transitive = true;
}
To pull in the annotations module which contains #GlideModule, you have to use transitive = true
This is may be glide issue so, I will prefer to don't update glide to com.github.bumptech.glide:glide:4.4.0 till now. you can use older version like com.github.bumptech.glide:glide:4.3.1 or com.github.bumptech.glide:glide:4.3.0 or com.github.bumptech.glide:glide:4.2.0
you can read more about these issues on
issue 2318
issue 2319
Just use this in app.gradle and you are done :
compile 'com.github.bumptech.glide:glide:3.7.0'
Just need to do these steps to avoid this error:
1 - update your sdk version to 27
2 - In your dependencies in build.gradle:
implementation('com.github.bumptech.glide:glide:4.6.1') {
exclude group: "com.android.support"
}
And you are good to go as this one resolved my issue.
implementation 'com.github.bumptech.glide:glide:4.0.0-RC0'
Once check with this dependencies for latest android studio 3.0.2 this dependencies build proper gradle.
You can use it like this in your build. Simply:
dependencies {
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
}

cannot resolve floatinbuttonAction and snackbar

I'm very new to the android development. I imported my friend's project in my android studio and I'm having this trouble right now that I'm unable to sort out on my own. Please help me fix it.
You have to add the design support library in your build.gradle :
implementation 'com.android.support:design:25.3.1'
Package android.support.design.widget.FloatingActionButton and android.support.design.widget.Snackbar lies under design-support library. You have to add design-support library into your project.
Add below dependencies into your app modules build.gradle file and Sync .
dependencies {
............
................
compile 'com.android.support:design:25.3.1'
}
Hope this will help
FloatingActionButton and snackbar are components of design LIB
Add this in your app gradle file
compile 'com.android.support:design:23.1.1'

Cannot resolve symbol 'FirebaseAuth'

Why am I getting this error? My repository and Google play services are up to date and I've used all the requires steps for using Firebase like copying firebase code in both build.gradle(Project and app). The intellisence doesn't even show FirebaseAuth but displays other members of Firebase.
Solved the error by adding this to the build.gradle file(for app) -
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
The 2nd dependency is to solve the version conflict error.
Add this dependency to Gradle.Build(Module:App)
compile "com.google.firebase:firebase-auth:9.0.2"
then sync with gradle :)
Add these two dependencies into your build.gradle
as 'compile' is replaced by 'implementation'
dependencies {
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation "com.google.android.gms:play-services-gcm:16.0.0"
}
***For the latest android studio version 3.0 and new ones ***
Same problem. Clean your project with "Build"->"Clean Project".
add the following to the build.gradle (app)
implementation 'com.google.firebase:firebase-auth:9.2.1'
For me this worked with all the firebase extensions:
eg.:
Android studio adds the following line to your gradle file:
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
You have to change it to:
implementation 'com.google.firebase:firebase-auth:16.0.1'
and add:
kapt 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
I have android studio 3.3.1 installed. Compile is replaced with implementation. So you have to write
implementation 'com.google.firebase:firebase-auth:16.1.0'
You should replace version according to the warning you get.
on dependencies in app gradle
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
this is useful android 3.0 and onwards versions auth:16.0.1 and
core:16.0.1Firebase will work
Solved the error by adding this to the build.gradle file(for app) -
compile 'com.google.firebase:firebase-auth:9.2.1'
compile "com.google.android.gms:play-services-gcm:9.2.1"
You may need to make sure that your activity is importing the Firebase Auth module. In your .java file (eg. Login.java):
import com.google.firebase.auth.FirebaseAuth;
Please add the below line in your build.gradle file:
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation "com.google.android.gms:play-services-gcm:10.2.1"
In my case, I was using firebase-auth and firebase-messaging with different versions. So After getting an error I kept the same version for both e.g.
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
After sync, my problem was solved. try to keep the version the same for firebase libraries
implementation 'com.google.firebase:firebase-auth:16.0.1'
make sure your firebase and all the dependency are the same versions.

Categories

Resources