当前位置:   article > 正文

关于Android Studio新老版本兼容性问题,在Github、码云、云效上拉取的代码无法运行,尝试这样设置可以解决大多数问题_android studio版本不支持pms

android studio版本不支持pms

许多小伙伴将以前Android Studio老版本写的代码git下来后发现无法运行,这种情况大概率是Android Studio新老版本gradle目录结构不一样导致的。新版本中Android Studio将项目级build gradle的部分配置迁移到了setting gradle中。将他们改回原来的结构就好了。

 第一步修改gradle版本

 

例如原来的版本为7.2

 现将它改为

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip

 第二步修改项目级gradle配置

原来的版本为

现在将红色框中的代码替换为

  1. buildscript {
  2. repositories {
  3. mavenCentral()
  4. google()
  5. jcenter()
  6. }
  7. dependencies {
  8. classpath 'com.android.tools.build:gradle:4.2.2'
  9. // NOTE: Do not place your application dependencies here; they belong
  10. // in the individual module build.gradle files
  11. }
  12. }
  13. allprojects {
  14. repositories {
  15. google()
  16. jcenter()
  17. maven { url "https://jitpack.io" }
  18. }
  19. }

 第三步修改setting gradle

 原来的格式为

现在将dependencyResolutionManagement注释

最后要注意gradle版本一定要和gradle插件版本保持一致

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/272842
推荐阅读
相关标签
  

闽ICP备14008679号