1. 程式人生 > >Android Studio 低版本Gradle升級到高版本時常見問題

Android Studio 低版本Gradle升級到高版本時常見問題

今天拿到一個用低版本Gradle的編譯的Android工程,gradle對版本的向下相容做的不太好,因此在高版本Gradle的電腦上會出很多問題。

1. Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.0.0.

<a href="fixGradleElements">Fix plugin version and re-import project</a>

解決方法:直接點選下面的Fix plugin version and re-import project。

2.Error:(17, 0) Gradle DSL method not found: 'runProguard()'

解決方法:app build.gradle中 runProguard改為minifyEnabled

3. Error:No such property: projectDependencies for class: com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated

解決方法:project build.gradle 中  'com.neenbedankt.gradle.plugins:android-apt:1.3+'  中的版本號1.3+改為1.4
4.Error:(29, 0) Could not find property 'processResources' on com.and

[email protected]284d979f.

androidManifestFile variant.processResources.manifestFile 改為 androidManifestFile variant.outputs[0].processResources.manifestFile

5.編譯時出現aapt.exe已停止工作

解決方法:該問題出現於compileSdfVersion為21時,只要將buildToolsVersion改為21.0.2(或更高的版本)就可以了。

PS:忽然發現StackOverFlow是一個非常有用的平臺,基本上開發時遇到的各種問題都能在上面找到答案或者線索。