Google Guava Invokedynamic需要--min-sdk-version> = 26

时间:2017-08-25 01:53:21

标签: android gradle kotlin android-studio-3.0

我在Android Studio 3.0中遇到此错误(另一个与2.3不同)。我一直在尝试修复删除一些依赖关系几个小时,没有任何工作。所以现在我不想要我还能尝试什么。

const functions = require('firebase-functions');
const admin = require("firebase-admin");
// Initializes app when using Firebase Cloud Functions 
admin.initializeApp(functions.config().firebase);
const databaseRef = admin.database().ref();


exports.updateEmail = functions.https.onRequest((request, response) 
    // Cross-origin headers
    response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS");
    response.setHeader("Access-Control-Allow-Origin", "YOUR-SITE-URL");
    response.setHeader("Access-Control-Allow-Headers", "Content-Type");

    const email = request.body.email;
    const uid = request.body.uid;

    // Update auth user
    admin.auth().updateUser(uid, {
        "email": email
    })
    .then(function() {
        // Update database nodes on success

        let fanoutObj = {};
        fanoutObj["/node1/" + uid + "/email/"] = email;
        fanoutObj["/node2/" + uid + "/email/"] = email;

        // Update the nodes in the database
        databaseRef.update(fanoutObj).then(function() {
            // Success
            response.send("Successfully updated email.");
        }).catch(function(error) {
            // Error
            console.log(error.message);
            // TODO: Roll back user email update
            response.send("Error updating email: " + error.message);
        });
    })
    .catch(function(error) {
        console.log(error.message);
        response.send("Error updating email: " + error.message);
    });
});

这是我的 gradle build

    Error while processing com/google/common/collect/Maps$NavigableAsMapView.class
com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)

我的 root build

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.costular.transmissionremote"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
}

androidExtensions {
    experimental = true
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.0.1'
    implementation 'com.android.support:design:26.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.dagger:dagger:2.11'
    kapt 'com.google.dagger:dagger-compiler:2.11'

    implementation 'io.reactivex.rxjava2:rxjava:2.1.3'
    implementation 'io.reactivex.rxjava2:rxkotlin:2.1.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

    implementation 'com.costular:kotlin-utils:0.1'
    implementation 'android.arch.persistence.room:runtime:1.0.0-alpha9'
    implementation 'android.arch.persistence.room:rxjava2:1.0.0-alpha9'
    kapt "android.arch.persistence.room:compiler:1.0.0-alpha9"

    implementation 'com.android.support:support-v4:26.0.1'
    //implementation 'com.android.support:support-vector-drawable:26.0.1'
    //testImplementation 'org.mockito:mockito-core:2.8.47'
    testImplementation 'junit:junit:4.12'
    //androidTestImplementation 'com.android.support.test:runner:1.0.0'

    androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.0", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    //implementation files('libs/transmission-rpc-java_main.jar')
}

如果你能帮助我,我很感激你们。

谢谢!

更新

:应用程序:依赖关系

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.1.4-2'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

1 个答案:

答案 0 :(得分:2)

implementation "com.google.guava:guava:23.0"

而不是

implementation "com.google.guava:guava:23.0-android"