Android Studio升級4.1.1后各種錯誤和解決方案
1,CMake Error: CMake was unable to find a build program corresponding to “Ninja“.
因為項目中使用到Cmake編譯的C/C++代碼,升級了Android Studio后編譯出現(xiàn)CMake Error: CMake was unable to find a build program corresponding to “Ninja”.CMAKE_MAKE_PROGRAM is not set.
執(zhí)行編譯查看編譯詳細(xì)報錯信息
gradlew :emsinglerecord:assembleDebug --stacktrace --info
最終更換了CMAKE的環(huán)境變量(電腦=>屬性=>高級系統(tǒng)設(shè)置=>環(huán)境變量=>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…,然后在創(chuàng)建的文件或者已經(jīng)有的studio64.exe.vmoptions文件里添加-Dfile.encoding=UTF-8
重啟Android studio該問題解決
3,編寫代碼無錯誤提示(警告、報紅等)
Android ButterKnife Zelezny插件導(dǎo)致的,在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.
資源找不到
修改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'
然后又會出現(xiàn)下面錯誤
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的位置 ] } } }
目前就遇到這些,等遇到新的再添加。
到此這篇關(guān)于Android Studio升級4.1.1后各種錯誤和解決方案的文章就介紹到這了,更多相關(guān)Android Studio升級4.1.1內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
百度地圖API提示230 錯誤app scode碼校驗失敗的解決辦法
筆者近2天在 Android Studio上玩了一下百度地圖,碰到了常見的"230錯誤 APP Scode校驗失敗",下面我來介紹一下具體的解決辦法2016-01-01Android圖像切換器imageSwitcher的實例應(yīng)用
這篇文章主要為大家詳細(xì)介紹了Android圖像切換器imageSwitcher的實例應(yīng)用,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-10-10Android Activity中onStart()和onResume()的區(qū)別分析
這篇文章主要介紹了Android Activity中onStart()和onResume()的區(qū)別,結(jié)合Activity的四種狀態(tài)簡單分析了Android Activity中onStart()和onResume()方法的作用,并補充說明了Activity中六個常用函數(shù),需要的朋友可以參考下2016-01-01Android實現(xiàn)數(shù)字跳動效果的TextView方法示例
數(shù)字跳動效果相信大家應(yīng)該都見過,在開發(fā)加上這種效果后會讓ui交互看起來非常不錯,所以下面這篇文章主要給大家介紹了Android實現(xiàn)數(shù)字跳動的TextView的相關(guān)資料,文中給出了詳細(xì)的示例代碼,需要的朋友可以參考學(xué)習(xí),下面來一起看看吧。2017-04-04