Invoke-customs are only supported starting with Android N (--min-api 26)

@[TOC](Invoke-customs are only supported starting with Android O/N (–min-api 26)常见问题笔记(一))

解决办法

在\android\app\build.gradle中添加以下内容:

    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

如下:

apply plugin: 'com.android.application'

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

然后Sync Now即可运行。

你可能感兴趣的:(常见问题专区)