I got this error and I don't know how to fix it.
These are my dependencies in application
dependencies {
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.firebase:firebase-database-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation platform('com.google.firebase:firebase-bom:28.4.1')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation ('com.google.zxing:core:3.3.3')
implementation 'com.braintreepayments.api:drop-in:3.3.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.loopj.android:android-async-http:1.4.9'
}
Plzz help me to fix this errors?
Edited
I changed minsdk version but it showed another error, also add uses-sdk tools like this error, but got same error.
This problem occur when you are adding two dependencies that includes the same classes.
And I think the accused one should be this braintreepayments dependency, so I recommend updating
implementation 'com.braintreepayments.api:drop-in:3.3.0'
TO a newer version
implementation 'com.braintreepayments.api:drop-in:5.2.2'
And for sure you have already added the mven repo to your project gradle file.
repositories {
maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}
}
}
For more, check this:
https://github.com/braintree/braintree-android-drop-in
EDITED
Don't forget to set the min sdk version 21 or above
defaultConfig {
...
minSdkVersion 21
...
}
and remove this line if exists in the manifest
<uses-sdk android:minSdkVersion="16"/>
Related
I am using setToken(FirebaseInstanceId.getInstance().getToken()) code to get the token but I am getting the following error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzv;
build.gradle
dependencies {
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'android.arch.lifecycle:extensions:1.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
//noinspection GradleCompatible
implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
implementation 'pub.devrel:easypermissions:0.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0-rc02'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'net.bohush.geometricprogressview:geometricprogressview:1.1.1'
implementation project(path: ':andoird-sdk')
implementation project(path: ':opentok-android-sdk-2.16.3')
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
The above code is my build.gradle. Help me to fix the issue.
you need to use FirebaseMessagingService to get token .. you will get token into its own method
public class MyFirebaseMessagingService extends FirebaseMessagingService {
#Override
public void onNewToken(final String token) {
/// you will get token here you
enter code here
}
}
First of all fix version of all firebase library to latest version.
you cant mix versions <= 12 and versions >= 15 of Firebase libraries as mentioned here
then check you have properly enable Multidex on your project. Enable multidex for apps with over 64K methods
then use build -> clean to cleanup your project and dependencies.
and for using token use the way of #sonali:
I need to use a different set of firebase libraries in the project. But I'm getting the following error :
Unable to resolve dependency for ':#debug/compileClasspath': Could not resolve com.android.support:support-v13:28.0.0.
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-iid:19.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
If you want to use the latest versions, then you can use firebase BoM, in the build.gradle, write the following:
dependencies {
// Import the platform
implementation platform('com.google.firebase:firebase-bom:20.0.1')
// When using a BoM, dependencies don't require a specified version
// If you do specify a version, it overrides the library version specified in the BoM
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-firestore'
}
com.google.firebase:firebase-bom:20.0.1 will contain the latest version of all firebase libraries, then to use each specific library you add them as you normally do but without a version.
References:
https://firebase.google.com/docs/android/setup#firebase-bom
I have made the following changes to my build.gradle(app) file.
apply plugin: 'kotlin-kapt'
and
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0-alpha01'
kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0-rc01'
implementation 'androidx.room:room-runtime:2.1.0-rc01'
kapt 'androidx.room:room-compiler:2.0.0-rc01'
implementation 'androidx.paging:paging-runtime:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'io.sentry:sentry-android:1.7.16'
implementation 'org.slf4j:slf4j-nop:1.7.25'
}
And now the Kotlin compiler is throwing the following error about my EntryDAO.kt and EntryDatabase.kt files:
The error message is quite clear.
The room’s Delete, Update methods signature has changed. It needs to return void or int.
Edit: I checked again, your gradle file mixed androidx library and pre-AndroidX versions of Lifecycle.
Please follow the link to use the correct library combination: https://developer.android.com/jetpack/androidx/releases/lifecycle
I use the latest version of Android Studio 3.2 & Plugin. When I try to connect firebase it show me to add dependencies -implementation 'com.google.firebase:firebase-auth:16.0.3:15.0.0' for Firebase authentication | implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0' for Realtime Database | implementation 'com.google.firebase:firebase-storage:16.0.1:15.0.0' for Cloud Storage
When using these dependencies it connect Firebase properly but Sync Failed. How to Use these dependencies?
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3:15.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
I had faced the same issue before. If there is the update available then update your android it will fix it. from my experience when I use the assistant to add the dependencies then it comes like this
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
but the it is not correct update it with this
implementation 'com.google.firebase:firebase-database:16.0.1'
or
implementation 'com.google.firebase:firebase-database:15.0.0'
or this
maybe this will help you
here is official documentation for help
Update you firebase dependencies like this:
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
Basically, remove the last ":15.0.0" part. You probably copied these from the firebase website and made a mistake while pasting
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:exifinterface:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
implementation 'com.android.support:support-v4:28.0.0-alpha3'
implementation 'com.android.support:design:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-vector-drawable:28.0.0-alpha3'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
}
These are my dependencies but it is giving me gradle errors, its because of the FirebaseUI dependency as when I delete that the app builds fine.
Can anyone help me how to resolve this? I know its most probably some version issue.
According to the docs:
As of version 4.1.0, FirebaseUI has the following dependency versions:
Library Version
firebase-auth 16.0.1
play-services-auth 15.0.1
firebase-database 16.0.1
firebase-firestore 17.0.1
firebase-storage 16.0.1
Update the following to dependencies:
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
to this:
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
Also add:
implementation 'com.google.firebase:firebase-core:16.0.1'
Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.
In the top level gradle file use the following google-service plugin:
classpath 'com.google.gms:google-services:4.0.2'
If FirestoreRecyclerAdapter is showing an error means.....
just add these dependencies
implementation 'com.firebaseui:firebase-ui-firestore:8.0.1'
implementation 'com.google.firebase:firebase-core:19.0.2'
This will work fine