Android Studio升级4.1.1后各种错误和解决方案

2020-12-10 0 139

1,CMake Error: CMake was unable to find a build program corresponding to “Ninja“.

因为项目中使用到Cmake编译的C/C++代码,升级了Android Studio后编译出现CMake Error: CMake was unable to find a build program corresponding to “Ninja”.CMAKE_MAKE_PROGRAM is not set.

执行编译查看编译详细报错信息

gradlew :emsinglerecord:assembleDebug  –stacktrace –info

最终更换了CMAKE的环境变量(电脑=>属性=>高级系统设置=>环境变量=>Path里修改了原来的cmake路径为最新的D:\\VS\\cmake\\3.10.2.4988404\\bin);并且在SDK Manager里下载了最新的NDK,在Project Structure=>SDK Location里更新Andoid NDK location为D:\\VS\\ndk\\21.3.6528147后这个错误消失。

2,编译时,Build窗口报错信息里显示乱码(中文显示乱码)

因为这个是乱码看不到具体的报错原因,所以需要解决这个问题。
点击Help => Edit Custom VM options…,然后在创建的文件或者已经有的studio64.exe.vmoptions文件里添加-Dfile.encoding=UTF-8
重启Android studio该问题解决

3,编写代码无错误提示(警告、报红等)

Android ButterKnife Zelezny插件导致的,在Settings=>Plugins里卸载掉后重启Android Studio正常

4,Plugin Error: Plugin “simpleUML” is incompatible (supported only in IntelliJ IDEA)

插件不兼容,在C:\\Users\\Administrator\\AppData\\Roaming\\Google\\AndroidStudio4.1\\plugins中删除\”simpleUML\”插件,重新打开后OK。

5,error: resource android:attr/dialogCornerRadius not found.

资源找不到

Android Studio升级4.1.1后各种错误和解决方案

修改compileSdkVersion 28 , targetSdkVersion 28后编译OK。

6,类似这样的报错:Could not find method apt() for arguments [org.androidannotations:androidannotations:3.3.2]

1,build.gradle里注释掉所有的android-apt:

//  classpath \'com.neenbedankt.gradle.plugins:android-apt:1.4\'
//  apply plugin: \'com.neenbedankt.android-apt\'

2,修改apt为

// apt \'org.androidannotations:androidannotations:3.3.2\'
annotationProcessor \'org.androidannotations:androidannotations:3.3.2\'

然后又会出现下面错误

7,错误: Could not find the AndroidManifest.xml file, going up from path [D:\\Work\\WorkSpace\\AndroidVideo…

build.gradle里添加如下:

defaultConfig {
 applicationId \'com.danikula.videocache.sample\'
 minSdkVersion 15
 targetSdkVersion 23
 versionCode 1
 versionName \'1.0\'
 javaCompileOptions {
  annotationProcessorOptions {
   arguments = [
     \'resourcePackageName\': android.defaultConfig.applicationId,
     \"androidManifestFile\": \"$projectDir/src/main/AndroidManifest.xml\".toString() //主要是这一行,告诉androidManifestFile的位置
   ]

  }

 }
}

目前就遇到这些,等遇到新的再添加。

到此这篇关于Android Studio升级4.1.1后各种错误和解决方案的文章就介绍到这了,更多相关Android Studio升级4.1.1内容请搜索自学编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持自学编程网!

遇见资源网 Android Android Studio升级4.1.1后各种错误和解决方案 http://www.ox520.com/23871.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务