问题一:项目debug失败
问题描述:
debug时app直接退出,提示:This device cannot be debugged using the native debugger
解决方法:
点击AndroidStudio工具栏 Run
-> Edit Configurations...
如下图所示,Debug Type:选择Java Only
问题二:android studio安装markdown插件不能预览
问题描述:
android studio安装了markdown插件Markdown Editor , 提示:Not Support JCEF: Your environment does not support JCEF, cannot use Markdown Editor
解决方法:
- 双击Shift, 搜索Choose Boot Java Runtime for the IDE...
- 弹出框中,选择第一个,点击OK。
问题三:升级AndroidStudio版本,项目编译报错
问题描述:
报错提示:
Cause: com/android/tools/idea/gradle/run/OutputBuildAction has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
解决方法:
- 方法一:安装一个老版本的AndroidStudio
- 方法二:
根据Gradle版本,调整gradle插件版本
;我这里用的gradle版本为gradle-6.5-all,那么gradle插件版本应该是4.1.0+。调整之后就编译成功了。Android Gradle 插件版本
问题四:AndroidStudio-Tool Windows-Build窗口中,中文显示乱码
问题描述:
如下图,编译时中文显示成乱码
解决方法:
- 双击
Shift
,输入vmoption
,点击Edit Custom VM Options...
- 在打开的studio64.exe.vmoptions中添加
-Dfile.encoding=UTF-8
问题五:高版本gradle插件的android项目,资源ID使用swtich case编译时报错
问题描述
错误: 需要常量表达式
case R.id.xxxx: {
^
Resource IDs will be non-final by default in Android Gradle Plugin version 8.0, avoid using them in switch case statements More... (Ctrl+F1)
Inspection info: Avoid the usage of resource IDs where constant expressions are required.
在 Android Gradle 插件版本 8.0 中,资源 ID 默认为非最终状态,请避免在 switch case 语句中使用它们更多... (Ctrl F1) 检查信息:避免在需要常量表达式的地方使用资源 ID。
解决方法:
- 方法1. 改为if else
- 方法2. 在gradle.properties中添加
android.nonFinalResIds=false
问题六:新版本logcat中忽略xxxx tag
在过滤框中 输入-tag:xxx
参考
问题七:androidstudio开发cpp,编译显示Unable to execute Clang-Tidy:Clang-Tidy is not found or cannot be exexute
参考
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :library_core project caused this error: /Volumes/curry/CustomProject/imagefusion/library_core/libs/effectAAR-release.aar
问题七:AndroidStudio Gradle不显示task
现象如下图:没有task list
解决方法:
可以点击上图中的Task list not built...
,会直接跳出Setting -> Experimental
的设置页面。
androidstudio版本不同,选项内容会不同;
勾选(或取消勾选)后,需要重新sync一下
- Android Studio Meerkat | 2024.3.1 Patch 1 需要勾选如下选项
- Android Studio Arctic Fox | 2020.3.1 Beta 1 需要取消勾选如下选项