我已经完成了Android Studio中的编码部分。然后,我运行了构建APK,突然发生了错误。
dev
答案 0 :(得分:1)
按照错误日志中的建议进行以下更改之一。
1. In app/build.gradle, add compileoptions for java 1.8 in android block.
android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
2. change minSDKVersion to 26.
android {
...
// change minSDKVersion to 26
defaultConfig {
...
minSdkVersion 26
....
}
}
答案 1 :(得分:1)
答案确实是例外。只需将此代码添加到build.gradle:
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
并添加为@Ranjan Kumar说的,最小的sdk android版本:
android {
defaultConfig {
minSdkVersion 26
}
}