升级到Android Studio 3.4后,出现此错误

时间:2019-04-24 09:40:59

标签: android compilation

我有一个在Android Studio 3.3上完成的项目,它运行正常,没有任何问题,但是现在,当我将其升级到Android Studio 3.4时,出现了此编译错误。

我添加了Java 1.8版本,但除此以外的所有版本对我都有帮助。

这是我的Build.APP文件

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

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "applicationID"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 14
        multiDexEnabled true
        versionName "1.5.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }


}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'


    implementation 'com.google.android.gms:play-services-ads:17.2.0'
    implementation 'com.facebook.android:audience-network-sdk:5.1.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.6.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6'
    implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.6'
    //    implementation 'com.google.android.exoplayer:extension-rtmp:2.8.4'
    implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.6'
    implementation 'com.google.android.exoplayer:exoplayer:2.9.6'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-config:16.5.0'
    // Firebase Messages
    // Add the In-App Messaging depencency:
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'
    // Check that your Firebase dependency is up-to-date:
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'

这是我的Build.Project

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        classpath 'com.google.gms:google-services:4.2.0'

        // 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
}

这是我尝试对其进行编译时得到的错误图片。

Error 1

Error 2

enter image description here

1 个答案:

答案 0 :(得分:1)

我只是从“首选项”中禁用了“即时运行”,现在一切正常