realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.46k stars 1.75k forks source link

Duplicate files copied in APK #5341

Closed Radeonisos closed 7 years ago

Radeonisos commented 7 years ago

Hi

 Thanks for this amazing library :-)

But after i upgrade my realm, i had some errors. I change many word and the configuration but i have one 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: /Users/davidfournier/.gradle/caches/modules-2/files-2.1/io.realm/realm-android/0.82.1/3e4f47bc60063111a375200f866192bf821efa93/realm-android-0.82.1.jar File2: /Users/davidfournier/.android/build-cache/f7a2c2ad189e7e56934b8df205d0b5dd51cbc61f/output/jni

Do you have any ideas ?

my gradles ::

`apply plugin: 'com.android.application' apply plugin: 'realm-android'

android { compileSdkVersion 25 buildToolsVersion "25.0.3" defaultConfig { applicationId "com.entreprise.davfou.abschallenge" minSdkVersion 19 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' } } aaptOptions { cruncherEnabled = false } realm { syncEnabled = true; } configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' } }

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.constraint:constraint-layout:1.0.2' compile 'com.android.support:design:25.3.1'

//MaterialViewPager
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.florent37:materialviewpager:1.2.1'
//Checkable image
compile 'com.github.zagum:Android-SwitchIcon:1.3.4'
// Realm
compile 'io.realm:realm-android:0.82.1'
//ProgressBar
compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.google.code.gson:gson:2.7'
//Picasso
compile 'com.squareup.picasso:picasso:2.5.2'
//Carousel
compile 'fr.rolandl:carousel:1.0.1@aar'

} `

`// 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.3' classpath 'io.realm:realm-gradle-plugin:3.2.0'

    // 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" } } }

task clean(type: Delete) { delete rootProject.buildDir } `

and myApplication `

import android.app.Application;

import io.realm.Realm; import io.realm.RealmConfiguration;

public class MyApplication extends Application {

@Override
public void onCreate() {

    super.onCreate();

    Realm.init(getApplicationContext());

    // create your Realm configuration
    RealmConfiguration config = new RealmConfiguration.
            Builder().
            deleteRealmIfMigrationNeeded().
            build();
    Realm.setDefaultConfiguration(config);

}

} `

Zhuinden commented 7 years ago

You need to remove

// Realm
compile 'io.realm:realm-android:0.82.1'

Then probably do a clean+rebuild.

Also latest version is 3.7.2, not 3.2.0

Radeonisos commented 7 years ago

ohhh yes sorry for that....