Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:将字节码转换为dex:Realm时出错_Android_Gradle_Realm_Android Studio 3.0 - Fatal编程技术网

Android 错误:将字节码转换为dex:Realm时出错

Android 错误:将字节码转换为dex:Realm时出错,android,gradle,realm,android-studio-3.0,Android,Gradle,Realm,Android Studio 3.0,android中的域获取错误: Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lio/realm/Realm$1$1; 康吉格: apply plugin: 'realm-android' buildscript { repositories { jcenter() } dependencies

android中的域获取错误:

Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lio/realm/Realm$1$1;
康吉格:

apply plugin: 'realm-android'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "io.realm:realm-gradle-plugin:4.2.0"
    }
}

realm {
    syncEnabled = true
}

    compile 'io.realm:realm-android:0.87.5'
    annotationProcessor 'io.realm:realm-android:0.87.5'

我尝试了clean project rebuild project not happend

您可以像这样轻松解决此问题:

apply plugin: 'realm-android'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "io.realm:realm-gradle-plugin:4.2.0"
    }
}

realm {
    syncEnabled = true
}

//compile 'io.realm:realm-android:0.87.5' // <-- removed
//annotationProcessor 'io.realm:realm-android:0.87.5' // <-- removed
apply插件:'realmandroid'
构建脚本{
存储库{
jcenter()
}
依赖关系{
classpath“io.realm:realm gradle插件:4.2.0”
}
}
王国{
syncEnabled=true
}

//编译'io.realm:realm android:0.87.5'//为什么您使用两个不同版本的realm?为什么您同时使用版本0.87.5和4.2.0?我不需要依赖关系?如何使用?))我花了这么多时间来查找。在文档中有一个例子,我看到了0.72。ⅩRealm Gradle插件为您添加了依赖项