提示 Gradle 版本不兼容,升级后就报错了 。
1.gradle安装包镜像
//distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.5-bin.zip //镜像
2. Build报错:A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
Gradle 8.5 Release Notes:Gradle8.5全面支持Java21
distributionUrl=https://services.gradle.org/distributions/gradle-8.5-bin.zip
classpath 'com.android.tools.build:gradle:8.3.0'
3.Namespace not specified. Specify a namespace in the module’s build file.
app/build.gradle
apply plugin: 'com.android.application'
android {
namespace "com.hty.browser" //新增
compileSdkVersion 26
defaultConfig {
applicationId "com.hty.browser"
minSdkVersion 19
targetSdkVersion 26
}
}
4.Android Studio:case 错误: 需要常量表达式
https://blog.csdn.net/wchinaw/article/details/7325641
http://tools.android.com/tips/non-constant-fields
case 变量,不再支持,使用 if 代替。
快捷键:选中switch后,按alt+enter,选择replace为if..else