原文:https://blog.csdn.net/ytfunnysite/article/details/78864556
1、Error:Failed to resolve: com.android.support:multidex:1.0.2
Add Google Maven repository and sync project
Open File
Show in Project Structure dialog
Error:Failed to resolve: com.android.support:multidex-instrumentation:1.0.2
Add Google Maven repository and sync project
Open File
Show in Project Structure dialog
Error:(23, 0) Cannot set the value of read-only property ‘outputFile’ for object of type com.android.build.gradle.internal.api.LibraryVariantOutputImpl.
Open File
解決:
修改build.gradle腳本,增加google()
2、Error:(604, 5) error: expected reference but got (raw string) @+android:style/Animation.Translucent.
解決:
沒有找到好的辦法,最后修改gradle的版本,使用4.2.1或者
修改gradle.properties文件,增加以下參數配置
android.enableAapt2=false
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
解決:
修改gradle.properties文件,增加以下參數配置
android.enableAapt2=false
3、Error:Unable to load class ‘org.gradle.api.internal.component.Usage’.
Possible causes for this unexpected error include:
- Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network) - The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart) - Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
解決:
修改gradle的版本
4、Error:No such property: FOR_RUNTIME for class: org.gradle.api.attributes.Usage
解決:
將gradle的版本從4.3.1降級到4.2.1
5、亂碼
Error:(84, 35) 閿欒: 緙栫爜UTF-8鐨勪笉鍙槧灝勫瓧絎?
文件編碼分為UTF-8編碼和GBK編碼,編譯時使用UTF-8編碼,就會導致某些頁面亂碼。
解決辦法:
1、下方的UTF-8換成GBK
2、跳出提示選擇”reload“,此時注釋之類的亂碼會顯示正確。
3、右下角再選擇UTF-8
4、跳出提示選擇”convert“,此時編碼從GBK轉為UTF-8。
5、編譯運行,就不會出現亂碼錯誤了
6、如果還有提示,哪個文件出錯,就如上轉換該文件,問題解決!