Error while integrating firebase to android studio - android

i am trying to integrate firebase to my android project but constantly getting error of
"In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[17.0.
4]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:17.3.4 -> com.google.firebase:firebase-iid#[17.0.4], but fire
base-iid version was 20.0.2."
my code for the app gradle build is-------
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.goldfish"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
}
}
packagingOptions {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.google.firebase:firebase-messaging:17.3.4"
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-analytics:17.2.2'
}

Upgrade to the latest versions of the Firebase libraries:
implementation 'com.google.firebase:firebase-messaging:20.1.5'
implementation 'com.google.firebase:firebase-analytics:17.3.0'

Related

How to fix More than one file was found with OS independent path 'build-data.properties'

After adding a dependency to "androidx.security:security-crypto:1.0.0-alpha02", I get the error message "More than one file was found with OS independent path 'build-data.properties'." I have tried to correct it by changing the version of the library (1.1.0-alpha01; 1.0.0-alpha02; 1.0.0-alpha01) and modifying the packageoptions section as I have found on the net but nothing has worked. Thanks for your help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.skcc.myapp"
minSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable false
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-vision:11.8.0'
implementation "androidx.security:security-crypto:1.0.0-alpha02"
//
}
I found solution at Android Studio: Duplicate files copied in APK META-INF/DEPENDENCIES when compile
Regards
packagingOptions {
pickFirst '**'
}

Android: Multiple dex files define Lcom/google/android/gms/location/places/zza;

I can't stop getting this error every time, and I don't know what caused it and how I can solve it:
Multiple dex files define Lcom/google/android/gms/location/places/zza;
I think it may have to do with google-services, but I'm not entirely sure.
app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 14
targetSdkVersion 28
versionCode 10173
versionName "4.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Fixes "Duplicate files copied in APK" build bug
packagingOptions {
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'
}
}
dependencies {
// Pushy SDK
implementation 'com.google.firebase:firebase-messaging:17.5.0'
compile 'me.pushy:sdk:1.0.43'
// AppCompat v7 Dependency
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.google.android.gms:play-services-maps:16.1.0'
compile 'com.google.android.gms:play-services-places:10.2.0'
// Google Play Services Dependencies
compile 'com.google.android.gms:play-services-location:16.0.0'
compile 'com.google.android.gms:play-services-ads:17.1.1'
// All .jar files in ./libs
compile fileTree(dir: 'libs', include: ['*.jar'])
}
apply plugin: 'com.google.gms.google-services'
If your app has more than 65535 methods, you need to enable the multidex format for your app.
This can be caused by having lots of dependencies in your project.

error: cannot access zzbgl error keep re-appearring

I'm creating a Uber-like app. So you can imagine the user will be able to log in using facebook/google/firebase for those using phone numbers.
The code is fine as it was used before, however I lost the previous project's gradle settings. as such now I am faced with error message
error: cannot access zzbgl class file for com.google.android.gms.internal.zzbgl not found
please help me.
I have isolated the problem. if I delete all firebase related codes, I wouldnt have this issue.
FirebaseAuth, FirebaseUser etc.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.sunshinetechie.gethitched"
minSdkVersion 21
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'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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.facebook.android:facebook-android-sdk:4.15.0'
implementation 'com.google.http-client:google-http-client-android:+'
implementation 'com.google.api-client:google-api-client-android:+'
implementation 'com.google.api-client:google-api-client-gson:+'
implementation "com.android.support:appcompat-v7:26.1.0"
implementation 'com.google.android.gms:play-services-maps:11.0.2'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
}
apply plugin: 'com.google.gms.google-services'

Any solution to error: resource android:attr/popupPromptView is private?

I have an android project that was made in eclipse, I have imported it to Android Studio started fixing the errors, but I don't know how to fix this one
I have already changed the targetSdkVersion, minSdkVersion and compileVersion, I also changed some dependencies but still not a fix
Here is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.wansoft"
minSdkVersion 14
targetSdkVersion 28
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation project(':sherlockSlidingMenu')
implementation project(':pullToRefresh')
implementation project(':roboAccordionView')
//compile 'com.android.support:support-v4:25.3.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
//compile 'com.android.support:support-v4:18.0.0'
implementation files('libs/commons-lang3-3.1.jar')
implementation files('libs/guice-3.0-no_aop.jar')
implementation files('libs/http-request-5.4.jar')
implementation files('libs/jackson-core-asl-1.9.11.jar')
implementation files('libs/jackson-mapper-asl-1.9.11.jar')
implementation files('libs/javax.inject-1.jar')
implementation files('libs/retrofit-1.6.1.jar')
implementation files('libs/roboguice-2.0.jar')
implementation files('libs/spring-android-core-1.0.1.RELEASE.jar')
implementation files('libs/spring-android-rest-template-1.0.1.RELEASE.jar')
implementation 'com.android.support:support-annotations:+'
}
and here is the error i get:
Android resource linking failed
/Users/dario_leija/Documents/Proyectos_Documentos/ComanderoAndroid/wansoftApp/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:1550: error: resource android:attr/popupPromptView is private.
error: failed linking references.

Gradle Build fails [Android] 'META-INF/kotlinx-coroutines-core.kotlin_module'

Gradle did build my little adroid app fine.
After a while I added some more dependencies, it began to raise this error message and fails building.
Found similar problems, but all stated to exclude. Didnt help.
"
More than one file was found with OS independent path 'META-INF/kotlinx-coroutines-core.kotlin_module'
"
import looks like this
import kotlinx.coroutines.experimental.async
Gradle Build fiel looks like this
"
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
//exclue 'META-INF/kotlinx-coroutines-core.kotlin_module'
}
compileSdkVersion 27
defaultConfig {
applicationId "com.example.a18mas.app_mp3"
minSdkVersion 15
targetSdkVersion 27
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.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'
/*_______________________NEW DEPENDENCIES______________________*/
//local
implementation files("/libs/ftp4j-1.7.2.jar", "/libs/kotlinx-coroutines-core-0.22.5.jar")
//public
implementation 'com.beust:klaxon:3.0.1'
implementation 'com.github.kittinunf.fuel:fuel:+' //for JVM
implementation 'com.github.kittinunf.fuel:fuel-android:+' //for Android
implementation 'com.github.kittinunf.fuel:fuel-livedata:+' //for LiveData support
implementation 'com.github.kittinunf.fuel:fuel-rxjava:+' //for RxJava support
implementation 'com.github.kittinunf.fuel:fuel-coroutines:+' //for Kotlin Coroutines support
implementation 'com.github.kittinunf.fuel:fuel-gson:+' //for Gson support
implementation 'com.github.kittinunf.fuel:fuel-jackson:+' //for Jackson support
implementation 'com.github.kittinunf.fuel:fuel-moshi:+' //for Moshi support
implementation 'com.github.kittinunf.fuel:fuel-forge:+' //for Forge support
}
"
You probably did this but ...
clean and build project
rebuild Gradle
restart IDE (this did the trick for me when I had weird gradle issues)
check all the version numbers of the dependencies
I had the same issue with coroutines
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version"
I updated packagingOptions like this
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/main.kotlin_module'
}
After it everything work correctly.

Categories

Resources