AndroidStudio更新后Gradle文件发生更改导致应用崩溃
创始人
2024-10-11 09:30:06
0
  1. 在项目 build.gradle 文件中的 dependencies 中寻找 classpath 'com.android.tools.build:gradle:x.x.x' 这一行,将 x.x.x 的版本号从旧版本更新到最新版。

    buildscript {
       ...
       dependencies {
           classpath 'com.android.tools.build:gradle:4.2.0'
           ...
       }
    }
    
  2. 修改 Gradle 版本,在 app 的 build.gradle 文件中将 gradle 的版本更新到最新版。

    buildscript {
      ...
      dependencies {
          ...
          classpath 'com.google.gms:google-services:4.3.8'
      }
    }
    
    apply plugin: 'com.android.application'
    
    android {
      ...
      compileSdkVersion 30
      buildToolsVersion "30.0.3"
    
      defaultConfig {
          ...
          minSdkVersion 21
          targetSdkVersion 30
          ...
      }
    
      ...
    }
    
    dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'androidx.appcompat:appcompat:1.3.0'
      implementation 'com.google.android.material:material:1.3.0'
      implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    
      // 添加以下代码段
      implementation 'com.google.firebase:firebase-analytics:19.0.0'
      implementation 'com.google.firebase:firebase-messaging:21.0.0'
      implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
      implementation 'com.google.firebase:firebase-auth:21.0.1'
      implementation 'com.google.android.gms:play-services-auth:19.0.0'
    }
    
    // 添加以下代码段
    apply plugin: 'com.google.gms.google-services'
    
    
  3. 同步 Gradle。在 Android Studio 右上角点击 Sync Now 即可同步 Gradle。

完成以上三步之后,重新运行应用,问题应该就能够得到解决。

相关内容

热门资讯

此事引发网友热议!德普辅助器怎... 此事引发网友热议!德普辅助器怎么用,如何判断wpk辅助软件的真假(透视)普及教程(有挂透明挂)-哔哩...
截至发稿!新西部牛牛辅助,微乐... 截至发稿!新西部牛牛辅助,微乐自建房脚本最新版本更新内容,手筋教程(有挂教学)-哔哩哔哩1、微乐自建...
今天下午!红龙poker辅助平... 今天下午!红龙poker辅助平台,We poker辅助器下载(透视)关于教程(真实有挂)-哔哩哔哩1...
截至目前!新星游辅助软件试用版... 截至目前!新星游辅助软件试用版,拱趴大菠萝辅助神器,举措教程(有挂助手)-哔哩哔哩1、新星游辅助软件...
今年以来!aapoker怎么拿... 今年以来!aapoker怎么拿好牌,wepoker私人局透视方法(透视)开挂教程(有挂分享)-哔哩哔...
于此同时!丽水都来脚本辅助,a... 于此同时!丽水都来脚本辅助,aapoker能控制牌吗,手段教程(了解有挂)-哔哩哔哩1、每一步都需要...
透视最新!wepoker一直输... 透视最新!wepoker一直输的号能继续打吗,wepoker免费脚本弱密码(透视)必备教程(真的有挂...
来临!wepoker透视器免费... 您好,微乐内蒙古自建房脚本免费下载这款游戏可以开挂的,确实是有挂的,需要了解加去威信【4852750...
今年以来!wepoker透视脚... 今年以来!wepoker透视脚本安卓,wepoker插件功能辅助器(透视)专业教程(有人有挂)-哔哩...
一直以来!免费雀神挂件怎么安装... 一直以来!免费雀神挂件怎么安装,新九哥脚本下载,教程书教程(发现有挂)-哔哩哔哩1、用户打开应用后不...