Duplicate files copied in APK lib/x86/librealm-jni.so - android

When I try to run my app, I get this error:
Error:Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/x86/librealm-jni.so
File1: /home/redsolver/.gradle/caches/modules-2/files-2.1/io.realm/realm-android/0.84.1/b86074e6240f0f876701810a047b0261f7bd060e/realm-android-0.84.1.jar
File2: /home/redsolver/.android/build-cache/d261e339af4d29c93448691068c64db176d00257/output/jni
I got this error after adding the realm database to my project.
My app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "net.redsolver.solver"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.vistrav:ask:2.5'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'io.paperdb:paperdb:2.1'
compile 'io.realm:realm-android:0.84.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
}
My project build.gradle:
buildscript {
ext.kotlin_version = '1.1.3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.realm:realm-gradle-plugin:3.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I think that the library destroyed something, but I don't know how to fix it.

You need to remove compile 'io.realm:realm-android:0.84.1' from app's build.gradle.

Go to build in android studio and press Clean Project
Build > Clean Project
or
Build > Rebuild Project

I got the similar issue, and fixed it with changing the dependency to provided in the module
compile 'com.amap.api:3dmap:5.5.0' -> provided 'com.amap.api:3dmap:5.5.0'
compile 'com.amap.api:search:5.5.0' -> provided 'com.amap.api:search:5.5.0'
compile 'com.amap.api:location:3.6.1' -> provided 'com.amap.api:location:3.6.1'

Related

android:Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'

After updating android studio and several dependencies i now get this error message
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzeg.class
this is my gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "REMOVED_FOR_PRIVACY"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.firebaseui:firebase-ui:1.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:mediarouter-v7:26.0.2'
compile 'com.google.android.gms:play-services-location:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-crash:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-perf:11.2.0'
compile 'com.firebaseui:firebase-ui-auth:2.0.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:design:26.0.2'
compile 'com.github.bumptech.glide:glide:4.0.0'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support:multidex:1.0.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I already tried Cleaning and Rebuilding the project but nothing seems to work
okay what seemed to actually work was replacing
'com.google.android.gms:play-services-location:11.2.0'
with
'com.google.android.gms:play-services:11.2.0'
Bump up your build tool version to:
buildToolsVersion "26.0.2"
And exclude Play Services from Facebook, for example
compile ('com.facebook.android:facebook-android-sdk:[4,5)'){
exclude group:"com.google.android.gms"
}

Android Studio: Execution failed for task ":app:processDebugGoogleServices" error after added Firebase Storage

I just added the code to my Android Studio project to use Firebase Storage and got this error:
Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the
google-services plugin (information about the latest version is available at
https://bintray.com/android/android-tools/com.google.gms.google-services/) or
updating the version of com.google.android.gms to 10.0.1.
This is my app/build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "myappIDhere"
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 {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/commons-codec-1.10/commons-codec-1.10.jar')
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
compile 'com.google.gms:google-services:3.1.0'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is my project level build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The package_name in the google-services.json file is the same as in the manifest. What do I need to change?
just update your dependencies
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'

firebase on android: authentication and database, gradle sync with error

I have written an Android App that uses the Firebase database feature. Everything is working fine and now I would like to integrate the Authentication feature. So I modified my build.gradle for the app to include the two dependencies for the authentication:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.gmeunier.gestiondepoints"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-plus:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
compile 'com.google.firebase:firebase-auth:10.2.6'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Despite all my efforts and research on this topic, I still have the following error when I try to sync this gradle :
Failed to resolve: com.twitter.sdk.android:twitter:2.3.0
I can't find which lib/component versions I must use and I would appreciate help and support.
Your project's gradle file should look like this.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
// Required for 'com.firebaseui:firebase-ui:1.1.1'
maven {
url 'https://maven.fabric.io/public'
}
}
}
Original answer: https://stackoverflow.com/a/41664069/7339411
Add the following line inside "repositories", inside "allprojects" and "buildscript" to your Project Level build.gradle file:
maven {
url 'https://maven.fabric.io/public'
}

Firebase Android Studio (2.2.3) issue

I am facing a problem to compile Firebase in my android project.Here is my app level gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "<my_app_id>"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.2.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And here is the build gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am getting an error of Failed to resolve : com.google.firebase:firebase-core:10.2.1
If you are using android studio,
Goto tools -> Firebase
And follow on screen instructions. Android studio take care of the dependency issues.
Change
compile 'com.google.android.gms:play-services-auth:10.2.1'
to
compile 'com.google.android.gms:play-services-auth:10.0.1'
It works for me.
update your play service version and also update firebase dependency version.

Version conflict in gradle while adding com.google.gms.google-services

I was adding firebase cloud messaging to my project using the assistant, I encountered the following error message while android studio was building the project :
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the
google-services plugin (information about the latest version is
available at
https://bintray.com/android/android-tools/com.google.gms.google-services/)
or updating the version of com.google.android.gms to 9.8.0.
Here are the build files:
top-level:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app-level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "in.ac.iitb.treeplantationapp"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:design:25.0.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.google.android.gms:play-services:10.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-messaging:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You are using different versions of the google play services:
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.google.android.gms:play-services:10.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.1'
Use:
compile 'com.google.android.gms:play-services-appindexing:10.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'

Categories

Resources