溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

升級Android Studio4.1.1后出現錯誤如何解決

發布時間:2020-12-10 13:43:41 來源:億速云 閱讀:728 作者:Leah 欄目:開發技術

升級Android Studio4.1.1后出現錯誤如何解決?相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。

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 Studio4.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 Studio4.1.1后出現錯誤如何解決的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女