I have updated the firebase-auth dependency version but gradle build always fails. It was working fine for 16.0.1
Error Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.firebase:firebase-auth:16.0.2.
app level gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.dell.pitchpls"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.2'
//implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.5.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'
}
apply plugin: 'com.google.gms.google-services'
Project level gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The problem is resolved following this question. Just had to uncheck the offline work in setting/gradle
Try These steps:
Open Module setting of the application
Under Dependencies tab click on '+' symbol and add dependency manually a
Click on apply.
Firebase Documentation
If you visit this link and scroll down to add dependency section, you will find out that gradle dependency version is 16.0.1 only
Also, to avoid such errors, let Android Studio do automatically for you.
For this, in Android Studio, go to:
Tools-->Firebase (This will open a Firebase Assistant)
Now choose your category like Authentication,Analytics,Cloud Messaging,etc --> Click on "Setup your category" and proceed with the steps mentioned there. It will automatically add all the gradle files and generated JSON file.
Related
My project is connected to Firebase (Database) and now I am tring to add Google map. When I add one of the dependencies I get an error message while the sync.
It says something about using different version etc.
HELP !!
Description:
After I added this line to the app gradle file:
implementation 'com.google.android.gms:play-services-maps:16.0.0'
I got this error:
The library com.google.android.gms:play-services-base is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
with out the line that I have added everything is fine.
app gradle code:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rotem.bepart_appproject"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7: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-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
**implementation 'com.google.android.gms:play-services-maps:16.0.0'**
}
my project gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
To solve this, please change the following lines of code:
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
**implementation 'com.google.android.gms:play-services-maps:16.0.0'**
to
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
Keeping the same version for all Firebase dependencies is now anti-pattern.
I am recently getting this error message on gradle build/sync:
Image of the Error
When I click on "open file", it switches to the build.gradle (App) window.
I am not getting any solution for this on stackoverflow. Please check the code and let me know the issue.
I would really appreciate your help.
build.gradle (Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
}
dependencies {
/*compile('javax.inject:javax.inject:1',
'com.google.dagger:dagger:2.7',
'de.greenrobot:eventbus:2.2.1',
'io.reactivex:rxjava:1.2.0',
'io.reactivex:rxandroid:1.2.1')
compile files('libs/publisher-sdk-android-5.1.0.jar')*/
}
}
build.gradle (App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.appname"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
//multiDexEnabled = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
/*lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}*/
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:support-v4:27.1.1'
// Vungle SDK
//implementation 'com.github.vungle:vungle-android-sdk:6.2.5'
// Optional Google Play Services - Location and Basement
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
//Replace it with Google Analytics?
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
implementation 'org.jsoup:jsoup:1.8.3'
implementation 'com.github.simbiose:Encryption:2.0.1'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
use these
Check first
Go to Settings/Preferences > Build, Execution, Deployment option > Instant Run and uncheck all the three boxes.
1. Upgrading Gradle services URL:
Project > Gradle > Wrapper > gradle-wrapper.properties
Change URL from
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
(Find latest distributionUrl gradle plugin version Here: http://services.gradle.org/distributions
**Make sure to use gradle-x.xx-all.zip )
2. Delete your build folder
When you run project, build folder will be created automatically
3. Go to BUILD option in menu > Clean the project, Build the project
It should work without instant run.
I just add a module to my android project. Android Studio builds the project correctly, but when I attempt to launch the app, I getting this error.
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
My project gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.apollographql.apollo:apollo-gradle-plugin:0.4.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My module gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.apollographql.android'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.yamblet.smartliving"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':openpayandroid')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.airbnb.android:lottie:2.0.0'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.apollographql.apollo:apollo-runtime:0.4.4'
implementation "com.apollographql.apollo:apollo-android-support:0.4.4"
implementation 'com.apollographql.apollo:apollo-http-cache:0.4.4'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
implementation 'com.master.android:permissionhelper:1.1'
implementation 'com.iamhabib:easy-preference:1.0.1'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.github.jkwiecien:EasyImage:2.0.2'
//RETROFIT
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
//JSON PARSING
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.master.android:permissionhelper:1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
}
apply plugin: 'kotlin-android-extensions'
Module gradle that I added
apply plugin: 'com.android.library'
android {
compileSdkVersion 19
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.+'
compile files('libs/devicecollector-sdk-2.5.jar')
compile files('libs/google-http-client-1.17.0-rc.jar')
compile files('libs/google-http-client-android-1.17.0-rc.jar')
compile files('libs/google-http-client-jackson2-1.17.0-rc.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jackson-core-asl-1.9.11.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/junit-4.10.jar')
}
I clean and rebuild the project but, the error persists in the build process. Also I add multiDexEnabled true but didnt work. Thanks for your help.
I executed this gradle, and it works only problem I can see here is implementation project(':openpayandroid'), i didn't included it as its your private library, but on my understanding openpayandroid is also including some same dependencies which is causing the problem, so solution can be to exclude that group from it, eg implementation project(':openpayandroid')
{
exclude group 'the dex error causing lib group'
}
if above does'nt work try this
in your project build.gradle try use same version of all the groups e.g.
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "26.1.0" // your version
}
I think this might help but if this doesn't work try to check which file is responsible for this dex error and edit your question
One more thing you have include permission helper twice, remove (but it might not be the problem )
Make sure you have multiDexEnabled true ie. multidex enabled in your app gradle under android section
In build.gradle in default config use
multiDexEnabled true
and add dependency like compile 'com.android.support:multidex:1.0.3'
and extend your application file with MultidexApplication and rebuild your project. This will help you.
If you update the dependencies recently try this answer
Just clean the project & re-build the project
Build -> Clean project
Build -> Rebuild project
Have been suffering with this error the whole day.
Please don't mark this question as a duplicate.I have gone through many similar questions and none of the answers worked for me.
Full error :
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [E:\Educational\Career\Android\Projects
\FirebaseTutorial\app\build\intermediates\multi-dex\debug\componentClasses.jar]
(Can't read [C:\Users\Abhi\.gradle\caches\transforms-1\files-1.1\support-core-ui-
27.1.0.aar\167562b027fa4c1af2f69bce0de3dd43\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout
$Behavior.class]))
Things I have already tried :
Clean and Rebuild
Invalidate Caches and Restart
Deleted .gradle in my project folder and resynced the project.
Deleted whole .gradle of android studio (In Users/Username/.gradle) almost 2.5Gb of data and tried syncing again.
Added :
android {
defaultConfig {
multiDexEnabled true
}}
to gradle file:
My full gradle files :
app :
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.appz.abhi.firebasetutorial"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
Top level gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
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'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This error occurred after adding firebase auth.
P.S : Removing firebase auth dependencies and rebuilding the project doesn't show any error. i.e Removing
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
removes the error, but i want firebase Auth in my project.
The supported Support library for firebase-ui-auth:3.2.2 is 27.0.2 not 27.1.0
So change:
implementation 'com.android.support:appcompat-v7:27.1.0'
To
implementation 'com.android.support:appcompat-v7:27.0.2'
FirebaseUi-Android releases
As #Jagar explains in his answer, FirebaseUI 3.2.2 has transitive dependencies on Support Library 27.0.2. If you want to build with a different version of the Support Libraries, such as 27.1.0, you must follow the instructions described in the documentation to add the appropriate libraries in your dependencies. In your case, for FirebaseUI Auth, these are:
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
I have android app in kotlin which is giving me this error.
Error: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.google.firebase.auth.FirebaseAuth, unresolved supertypes: com.google.android.gms.internal.aad
and this
Error:Execution failed for task ':app:compileDebugKotlin'.
Compilation error. See log for more details
this is my app module
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "appname"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:animated-vector-drawable:26.1.0'
implementation 'com.android.support:mediarouter-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
//noinspection GradleCompatible,GradleCompatible
implementation 'com.google.android.gms:play-services:11.0.4'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
and my project gradle is this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have firebase.auth implementation but still, it's showing me the error.
Updating com.firebaseui:firebase-ui-auth to 3.3.1 fixed it for me. As the older versions (3.1.0 in my case) was not compatible with com.google.firebase:firebase-messaging v15
Updating all the dependencies from the "com.google.android.gms:" group and also the firebase-messaging version to 15.0.0. instead of 12.0.1 fixed this issue for me.
i see at least 2 problems in your gradle file:
You have a duplicated entry for "kotlin-stdlib-jre7" (one implementation and one compile). Remove the last one:
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
Not using the latest versions of firebase & google play services: update to firebase 11.6.2
The other thing that may happen is that you are using implementation instead of api for one of your dependencies which may conflict with another dependency in your module.
Add following in gradle:-
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
If you are using firebase-bom, then you should update to latest version. For me, after upgading to latest it started working.
Lastest version as of now :
com.google.firebase:firebase-bom:24.5.0
You can check latest version HERE
add this solves my problem
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"