Android Gradle 编译问题汇总

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

解决方法 在app的build的android加入以下代码

android {
    ...
    //将代码添加到app的build.gradle的android节点下
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

注解报错 Annotation processors must be explicitly declared now. The following dependenci

解决办法:在app的build中

android {
    ...
    defaultConfig {
        ...
        //添加如下配置就OK了
        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }

ABIs [armeabi] are not supported for platform. Supported ABIs are [arm64-v8a, armeabi-v7a, x86, x86_64].

原因一:NDK版本过新,需要18以下的旧版本
Android Gradle 编译问题汇总_第1张图片
我的原因是项目的ndk需要比较老的版本所以就换成了16,有可能你需要换成17,根据自己需要的ndk来配置,因为ndk18及以后ndk就不支持armeabi架构了。

Android Gradle 编译问题汇总_第2张图片
一般情况下换成了16之后ndk的地址会跟着变,但是我的就没有变,只能手动修改了。

原因二:NDK需要新的 但是gradle的架构写成了 armeabi 换成 ‘armeabi-v7a’ 就好了

android {
    ...
    defaultConfig {
        ...
        ndk {
            //abiFilters 'armeabi'
            abiFilters 'armeabi-v7a'
        }
    }
}

你可能感兴趣的:(Android)