Android2024.2.1升级错误

提示 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

相关推荐
Coffeeee1 小时前
如何使用Glide和Coil加载WebP动图
android·kotlin·glide
Kapaseker2 小时前
5 分钟搞懂 Kotlin DSL
android·kotlin
恋猫de小郭3 小时前
AI Agent 开发究竟是啥?如何用 AI 开发 Agent ?深入浅出给你一套概念
android·前端·ai编程
黄林晴3 小时前
Android 17 正式发布!target 37 一大批旧代码直接不能用了
android
Carson带你学Android3 小时前
Android 17 正式发布:AI 终于成了系统能力
android·前端·ai编程
三少爷的鞋4 小时前
当 UseCase 开始长期监听,它可能已经不是 UseCase 了
android
恋猫de小郭17 小时前
Android 限制侧载新进展,谷歌联合国内厂商推验证计划
android·前端·flutter
恋猫de小郭17 小时前
解读 Android 17 全新内存限制,有没有“豁免”后门?
android·前端·flutter
贾艺驰19 小时前
实战Android Framework: 新增一个系统权限
android
alexhilton1 天前
使用Android Archive进行打包
android·kotlin·android jetpack