看看前輩們都遇到了什么坑
看看AndroidStudio3.0都有了什么新改動
注意: 在升級AndroidStudio到3.0后打開老項目,會問你是否要升級gradle到4.1,如果你不升級,什么錯誤都沒有了!!!
我遇到的
-
Gradle Sync failed
Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'
解決方法:把項目中依賴的ButterKnife降級到8.4.0,這個基本用了butterknife都會遇到
-
AAPT2編譯報錯
事故:我集成的微信,極光大面積報錯
解決方法:在gradle.properties中關閉APPT2編譯,如下
android.enableAapt2=false
-
不能新建類和接口
Create Class Error
事故: 新增java類和接口,這就出現問題了,新建的時候,就會報錯:
Unable to parse template "Interface" Error message: This template did not produce a Java class or an interface
解決方法:根據template報錯,打開file->setting->file and templates 發現里邊的templates 全部是空的,class沒有模板,我就從別人那里考了一份出來粘貼上,發現可以新建類了,ok,問題得到解決。
但是過幾天發現又出問題了,再次打開studio,發現templates又空了,總不能每次開IDE都重新復制一次
最終的解決辦法如下:
打開studio所在的文件夾(在這之前請關閉studio),
在bin文件夾下找到這個文件studio.exe.vmoptions
使用記事本打開這個文件
添加下面這句話:
-Djdk.util.zip.ensureTrailingSlash=false
保存,ok,重啟studio,打開file and templates,發現所有的templates 都存在了,問題解決。