我们正在从ObjectBox 0.9.15迁移到1.3.4。

更新类后(删除了@Relation等),我们为ObjectBox Browser添加了依赖项,并获得了以下在构建时出现的错误:



我们的应用程序包含两个模块:Application类型和Library类型。 ObjectBox插件和依赖项仅在Application模块中使用和声明。如果我们将依赖关系更改为不带浏览器的依赖关系,那么一切都会顺利进行:

// This works well:
// debugCompile "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
debugCompile "io.objectbox:objectbox-android:$objectboxVersion"
releaseCompile "io.objectbox:objectbox-android:$objectboxVersion"

Proguard已关闭,已启用multidex。

您知道可能是什么问题吗?

应用插件:
buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url "http://objectbox.net/beta-repo/" }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.1'
        classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
        classpath 'com.google.gms:google-services:3.1.2'
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
        classpath 'io.objectbox:objectbox-gradle-plugin:1.3.4'
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.1'
        classpath 'com.google.gms:google-services:3.1.2'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'io.fabric'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'project-report'
apply plugin: 'io.objectbox'
// There are some oddities when retrolambda isn't the last plugin so try to keep it as the last applied plugin
apply plugin: 'me.tatarka.retrolambda'

// Other configs
// Finally
apply from: 'dependencies.gradle'
apply plugin: 'com.google.gms.google-services'

应用程序模块的依赖关系:
ext {
    butterknifeVersion = '8.8.1'
    conductorVersion = '2.1.3'
    daggerVersion = '2.11'
    exoPlayerVersion = 'r2.5.1'
    facebookVersion = '4.24.0'
    firebaseVersion = '11.8.0'
    glideVersion = '4.0.0'
    leakCanaryVersion = '1.5.4'
    logbackVersion = '1.1.1-6'
    okhttpVersion = '3.8.1'
    retrofitVersion = '2.3.0'
    supportVersion = '27.0.2'
    objectboxVersion = '1.3.4'

    dependencies {
        compile project(':vyng-core')

        // UI Libraries
        compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
        compile 'com.muddzdev:styleabletoast:1.0.9'
        compile "com.github.jarrodholliday:material-about-library:1.8.4"
        compile('com.vdurmont:emoji-java:3.2.0') {
            exclude group: 'org.json', module: 'json'
        }
        compile('eu.davidea:flexible-adapter:5.0.0-rc2') {
            exclude group: 'com.android.support', module: 'design'
        }
        //noinspection GradleCompatible
        compile "com.android.support.constraint:constraint-layout:1.1.0-beta4"

        // Rx Libraries
        compile 'io.reactivex.rxjava2:rxjava:2.1.6'
        compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
        compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'
        compile 'oxim.digital:rx2anim:0.9.1'
        compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'

        // Fabric Libraries
        compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
            transitive = true
        }

        //DB libraries
        debugCompile "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
        releaseCompile "io.objectbox:objectbox-android:$objectboxVersion"


        // Logger
        compile 'com.jakewharton.timber:timber:4.6.0'
        compile 'org.slf4j:slf4j-api:1.7.25'
        compile "com.github.tony19:logback-android-core:$logbackVersion"
        compile "com.github.tony19:logback-android-classic:$logbackVersion"

        // Util Libraries
        compile 'com.google.code.gson:gson:2.8.2'
        compile 'com.googlecode.libphonenumber:libphonenumber:8.8.1'
        compile "com.facebook.android:facebook-android-sdk:$facebookVersion"
        compile 'com.writingminds:FFmpegAndroid:0.3.2'
        compile 'com.google.guava:guava:23.0-android'

        // Image Libraries
        compile "com.github.bumptech.glide:glide:$glideVersion"
        annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
        compile "jp.wasabeef:glide-transformations:3.0.1"
        //compile 'jp.wasabeef:blurry:2.1.1'

        // Support Libraries
        compile "com.android.support:appcompat-v7:$supportVersion"
        compile "com.android.support:design:$supportVersion"
        compile "com.android.support:support-annotations:$supportVersion"

        // Firebase Libraries
        compile "com.google.firebase:firebase-core:$firebaseVersion"
        compile "com.google.firebase:firebase-auth:$firebaseVersion"
        compile "com.google.firebase:firebase-messaging:$firebaseVersion"
        compile "com.google.firebase:firebase-invites:$firebaseVersion"

        // Conductor Libraries
        compile "com.bluelinelabs:conductor:2.1.4"

        // Dependency Injection
        compile "com.google.dagger:dagger:$daggerVersion"
        annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
        provided "javax.annotation:jsr250-api:1.0"
        annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"

        //auth
        compile "com.facebook.android:account-kit-sdk:$facebookVersion"

        // Video Libraries
        compile "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion"
        compile "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion"
        compile "com.google.android.exoplayer:exoplayer-dash:$exoPlayerVersion"
        compile "com.yqritc:android-scalablevideoview:1.0.4"

        compile('com.github.jarrodholliday:videocache:2.7.1') {
            exclude module: 'slf4j-android'
            exclude group: 'com.google.android', module: 'android'
        }

        // Networking Libraries
        compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
        compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
        compile "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
        compile "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
        compile "com.squareup.okhttp3:okhttp:$okhttpVersion"

        // Debug/Testing
        debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
        releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
        testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion"
        testCompile 'junit:junit:4.12'
        testCompile "org.mockito:mockito-core:2.10.0"
        androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.0') {
            exclude module: 'support-annotations'
            exclude group: 'com.google.code.findbugs'
        }
    }
}

最佳答案

packagingOptionsandroid部分内添加gradle.build(详细信息为in docs)有所帮助。但是,如果有人知道更清洁而不是那么肤浅的解决方案,我将很高兴看到它。

android {

 // some stuff
 packagingOptions {
        pickFirst 'lib/armeabi-v7a/libobjectbox.so'
        pickFirst 'lib/arm64-v8a/libobjectbox.so'
        pickFirst 'lib/x86_64/libobjectbox.so'
        pickFirst 'lib/x86/libobjectbox.so'
    }
}

08-05 08:22