classpath "io.realm:realm-gradle-plugin:4.2.0"
然后
apply plugin: 'realm-android'
然后构建
错误:任务执行失败 ':应用程序:transformDexArchiveWithDexMergerForDebug'。
com.android.build.api.transform.TransformException:com.android.tools.r8.errors.CompilationError:程序类型已经 present:javax.annotation.CheckReturnValue
更多:
Caused by: java.io.IOException: Duplicate zip entry [32.jar:javax/annotation/CheckForNull.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:106)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
我的Gradle
dataBinding.enabled = true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
implementation "com.android.databinding:compiler:3.1.0-alpha04"
annotationProcessor 'com.android.databinding:compiler:3.1.0-alpha04'
implementation 'com.android.support:exifinterface:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:multidex:1.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.0.0-RC2'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.0-RC1'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.0.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.0.0'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'com.google.firebase:firebase-core:11.6.2'
implementation 'com.google.firebase:firebase-messaging:11.6.2'
implementation 'com.google.firebase:firebase-crash:11.6.2'
implementation 'com.jakewharton.rxbinding:rxbinding:0.4.0'
implementation 'com.wrapp.floatlabelededittext:library:0.0.6'
implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3'
一些信息: 在我想将Realm库导入我的项目
之前,一切都像魅力一样答案 0 :(得分:2)
您的build.gradle中的com.android.databinding:compiler:3.1.0-alpha04
和implementation
关键字具有相同的依赖关系annotationProcessor
使用较新的Android gradle插件版本,您只需添加
dataBinding {
enabled = true
}
在Android配置中,不添加任何依赖项in the official guide
尝试删除implementation "com.android.databinding:compiler:3.1.0-alpha04"
和annotationProcessor 'com.android.databinding:compiler:3.1.0-alpha04'
并离开android.dataBinding = true
,然后清理并重建项目。
答案 1 :(得分:1)
您可以尝试在build.gradle中添加以下代码行:
configurations.all {
resolutionStrategy.force "com.google.code.findbugs:jsr305:3.0.2"
}
如果仍然无效,您还可以添加类似
的内容implementation 'com.google.code.findbugs:jsr305:3.0.2'