您的位置:首頁技術文章
文章詳情頁

Android Studio升級4.1.1后各種錯誤和解決方案

瀏覽:17日期:2022-09-21 14:20:05
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:VScmake3.10.2.4988404bin);并且在SDK Manager里下載了最新的NDK,在Project Structure=>SDK Location里更新Andoid NDK location為D:VSndk21.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:UsersAdministratorAppDataRoamingGoogleAndroidStudio4.1plugins中刪除'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:WorkWorkSpaceAndroidVideo…

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
相關文章:
国产综合久久一区二区三区