Android Studio导入项目,报错 Error:Unsupported method: BaseConfig.getApplicationIdSuffix().


从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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM