Error: Invoke-customs are only supported starting with Android O (--min-api 26)

Mars-xq發表於2018-12-15

Android Studio SDK的版本升級到28以後 出現

Error: Invoke-customs are only supported starting with Android O (--min-api 26)

解決:新增compileOptions

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.xq.mybreakpointdownload"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    
    //新增
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

相關文章