Java 使用mapbox-android-plugin-places-v9:0.12.0时出现运行时异常

Java 使用mapbox-android-plugin-places-v9:0.12.0时出现运行时异常,java,android,android-studio,mobile,mapbox,Java,Android,Android Studio,Mobile,Mapbox,使用以下依赖项时,我基本上会遇到运行时错误: implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.12.0' 错误: Caused by: java.lang.RuntimeException 完整渐变文件: apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plug

使用以下依赖项时,我基本上会遇到运行时错误:

implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.12.0'
错误:

Caused by: java.lang.RuntimeException

完整渐变文件:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'


    def ENVIRONMENT_PRODUCTION = "\"ENVIRONMENT_PRODUCTION\""
    def ENVIRONMENT_TEST_BED = "\"ENVIRONMENT_TEST_BED\""
    def ENVIRONMENT_DA = "\"ENVIRONMENT_DA\""
    def ENVIRONMENT_LOCAL_GENY = "\"ENVIRONMENT_LOCAL_GENY\""
    def ENVIRONMENT_LOCAL_EMUL = "\"ENVIRONMENT_LOCAL_EMUL\""

    //Select Correct Build Environment  before building from above
    def BUILD_ENVIRONMENT = ENVIRONMENT_TEST_BED

    lintOptions {
        abortOnError false
    }

    signingConfigs {
        release {
            storeFile file("etc/keys/apptizer.keystore")
            storePassword "apptizer"
            keyAlias "apptizer"
            keyPassword "apptizer"
        }
        clover {
            storeFile file("etc/keys/apptizer.keystore")
            storePassword "apptizer"
            keyAlias "apptizer"
            keyPassword "apptizer"
            v2SigningEnabled false
        }
    }

    def buildType = "debug"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 176
        versionName "1.0.0.14.RELEASE"
        multiDexEnabled true
        signingConfig signingConfigs.release
        buildConfigField "String", "ENVIRONMENT", BUILD_ENVIRONMENT
        logger.warn('\n\nBUILD ENVIRONMENT SELECTED >>> ' + BUILD_ENVIRONMENT + "\n\n")

        applicationVariants.all { variant ->
            renameAPK(variant, defaultConfig, BUILD_ENVIRONMENT, buildType)
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            buildType = "release"
        }
    }

    flavorDimensions "main"

    productFlavors {
        poynt {
            applicationId "io.apptizer.pos"
            dimension "main"
        }
        standalone {
            applicationId "io.apptizer.merchant.standalone"
            dimension "main"
        }
        dtp_hnb {
            applicationId "io.apptizer.merchant.dtp.hnb"
            dimension "main"
        }
        clover {
            applicationId "io.apptizer.business.clover"
            minSdkVersion 17
            targetSdkVersion 25
            signingConfig signingConfigs.clover
            dimension "main"
        }
        aevi {
            applicationId "io.apptizer.merchant.aevi"
            minSdkVersion 22
            dimension "main"
        }
        verifone {
            applicationId "io.apptizer.merchant.verifone"
            minSdkVersion 22
            dimension "main"
        }
    }
    dataBinding {
        enabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }

    preBuild.dependsOn copyConfig(BUILD_ENVIRONMENT)

}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation fileTree(include: ['*.jar'], dir: 'libs/printer')
    implementation fileTree(include: ['*.aar'], dir: 'libs/single-date-and-time-picker')
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    //Swipeable list view
    implementation "com.daimajia.swipelayout:library:1.2.0@aar"
    //color picker
    implementation 'com.larswerkman:HoloColorPicker:1.5'
    //image loader
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    // Poynt Dependencies
//    poyntImplementation 'co.poynt.api:android-api-model:1.2.108@jar'
//    poyntImplementation 'co.poynt.android.sdk:poynt-sdk:1.2.27@aar'
    //QR Code Reader dependencies
    implementation 'com.google.zxing:core:3.2.1'
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
    //GCM dependencies
    implementation 'com.google.android.gms:play-services-analytics:11.0.4'

    implementation('com.github.jkwiecien:EasyImage:2.0.0') {
        transitive = false
    }
    dtp_hnbImplementation(name: 'mswipechippersdk', ext: 'aar')
    aeviImplementation(name: 'AeviApi-2.7.2', ext: 'aar')
    cloverImplementation 'com.clover.sdk:clover-android-sdk:219.5'
    verifoneImplementation(name: 'PaymentManager-1.9.0.352-release', ext: 'aar')
    verifoneImplementation(name: 'DeveloperSDK-release-2.3.18', ext: 'aar')
    //dropbox sdk
    implementation 'com.dropbox.core:dropbox-core-sdk:3.0.3'
    implementation 'com.squareup.okhttp3:okhttp:3.5.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    //Fullscreen webview
    implementation 'com.thefinestartist:finestwebview:1.2.7'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation 'com.github.gcacace:signature-pad:1.2.1'
    implementation 'org.apache.httpcomponents:httpmime:4.2.3'
    implementation "com.mikepenz:iconics-core:3.0.3@aar"
    implementation "com.mikepenz:iconics-views:3.0.3@aar"
    implementation 'com.mikepenz:ionicons-typeface:2.0.1.4@aar'
    implementation 'com.mikepenz:fontawesome-typeface:5.0.13.0@aar'

    //  compile 'com.squareup.okhttp3:logging-interceptor:3.9.1'

    def lifecycle_version = "1.1.1"

    // ViewModel and LiveData
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'

    //DateTime Picker : https://github.com/florent37/SingleDateAndTimePicker
//    implementation 'com.github.florent37:singledateandtimepicker:2.1.0'

    //Used to generate html bitmap for newer receipt versions
    implementation 'com.izettle:html2bitmap:1.9'
    implementation 'org.apache.velocity:velocity:1.7'
    //todo need to be removed and implemented in our own way had to added as a hotfix for round1 unreproducible crash
    implementation 'me.drakeet.support:toastcompat:1.1.0'

    //GCM dependencies
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.8'

    //Firebase
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-database:17.0.0'

    //Streams
    implementation 'com.annimon:stream:1.2.1'

    // Rx Java
    implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'

    // Retrofit
//    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
//    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
//    implementation 'com.squareup.retrofit2:adapter-rxjava2:2+'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'

    implementation 'com.google.android.material:material:1.0.0'

    //map
    implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0'){
        exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
    }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.27.0'
    implementation ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.27.0')
            {
                transitive = true
                exclude group: 'com.squareup.picasso'
            }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.5.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.12.0'
}

def renameAPK(variant, defaultConfig, environment, buildType) {
    variant.outputs.all { output ->
        def readableEnvironment = environment.replace("\"", "").replace("_", "-").toLowerCase()
        outputFileName = applicationName + "-v-" + defaultConfig.versionName + "-" + defaultConfig.versionCode + "-" + variant.productFlavors[0].name + "-" + buildType + "-" + readableEnvironment + ".apk"
    }
}

def copyConfig(environment) {

    return tasks.create("copyConfiguration", Copy) {
        logger.warn('Copy config for envi >>> ' + environment + "\n\n")
        def directoryToCopy
        switch (environment) {
            case "\"ENVIRONMENT_PRODUCTION\"":
                directoryToCopy = "env/production/"
                break;
            case "\"ENVIRONMENT_TEST_BED\"":
                directoryToCopy = "env/testbed/"
                break;
            default:
                directoryToCopy = "env/development/"
        }
        from directoryToCopy
        into '.'
    }
}


如果有人能帮助我解决此错误,我将不胜感激。

用此替换所有mapbox依赖项解决了我的问题:

    implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0') {
        exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
    }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v8:0.9.0'

我认为您必须确保依赖项和插件彼此兼容,最好使用类似的版本。

用此替换所有mapbox依赖项解决了我的问题:

    implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0') {
        exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
    }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v8:0.9.0'
我认为您必须确保依赖项和插件彼此兼容,最好使用类似的版本