從GitHub上clone下來的第三方庫,由於時間間隔很長,gradle的版本和本機的版本不一致,導入到Android Studio中會報錯,錯誤信息如下:
Error:Unsupported method: BaseConfig.getApplicationIdSuffix().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
Consult IDE log for more details (Help | Show Log)
到StackOverflow上搜索,發現解決方案如下:
第一步:修改項目的build.gradle文件,找到dependencies,修改classpath
classpath 'com.android.tools.build:gradle:1.0.0'
改成:
classpath 'com.android.tools.build:gradle:2.3.2'
截圖:
第二步:上一步修改了build.gradle中的版本之后,gradle-wrapper.properties文件中的gradle的版本也需要修改,由於上一步已經將build.gradle中的gradle版本已經升級到2.3.2,所以gradle-wrapper.properties中的gradle至少需要3.3版本以上。
直接修改:distributionUrl
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
截圖:
參考鏈接:
https://stackoverflow.com/questions/44546849/unsupported-method-baseconfig-getapplicationidsuffix