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

相关推荐
不爱说话郭德纲17 小时前
告别漫长的HbuilderX云打包排队!uni-app x 安卓本地打包保姆级教程(附白屏、包体积过大排坑指南)
android·前端·uni-app
Sinclair21 小时前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
雮尘1 天前
手把手带你玩转Android gRPC:一篇搞定原理、配置与客户端开发
android·前端·grpc
ktl1 天前
Android 编译加速/优化 80%:一个文件搞定,零侵入零配置
android
alexhilton2 天前
使用FunctionGemma进行设备端函数调用
android·kotlin·android jetpack
冬奇Lab2 天前
InputManagerService:输入事件分发与ANR机制
android·源码阅读
张小潇2 天前
AOSP15 Input专题InputManager源码分析
android·操作系统
RdoZam2 天前
Android-封装基类Activity\Fragment,从0到1记录
android·kotlin
奥陌陌2 天前
android 打印函数调用堆栈
android
用户985120035832 天前
Compose Navigation 3 深度解析(二):基础用法
android·android jetpack