AndroidStudio中“com.android.tools.build.gradle7.1.0”错误
创始人
2024-08-21 10:00:09
0
  1. 升级 Gradle 版本:在项目根目录下的 build.gradle 文件中修改 Gradle 版本。示例:
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.0' // 修改版本号为 7.2.0 或更新版本
    }
}
  1. 升级 Android Gradle 插件版本:修改 app 下的 build.gradle 文件中的版本号,如下所示:
plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 31
    buildToolsVersion "31.0.0"

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

// 修改以下代码(minSdkVersion 和 targetSdkVersion 可能需要根据具体情况调整)
android {
    compileSdkVersion 31
    buildToolsVersion "31.0.0"

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    ...
    // 将以下部分的版本号修改为 7.2.0 或更新版本
    buildFeatures {
        viewBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
}

相关内容

热门资讯

黑科技辅助挂"一起宁... 黑科技辅助挂"一起宁德钓蟹脚本"一贯真的是有辅助技巧(哔哩哔哩)一、一起宁德钓蟹脚本游戏安装教程牌型...
突发"天天卡五星攻略... 突发"天天卡五星攻略"切实真的是有辅助神器(哔哩哔哩)1、这是跨平台的天天卡五星攻略轻量版有透视,在...
透视有挂"四川家园游... 透视有挂"四川家园游戏辅助"一直真的是有辅助工具(哔哩哔哩)1、四川家园游戏辅助透视辅助软件激活码多...
相较于以往"创思维激... 相较于以往"创思维激k辅助器视频"其实是真的有辅助器(哔哩哔哩)1.创思维激k辅助器视频 选牌创建新...
透视苹果版"掌上娱潮... 透视苹果版"掌上娱潮汕透视"竟然是有辅助挂(哔哩哔哩)1、下载好掌上娱潮汕透视透视辅助下载之后点击打...
透视辅助"微乐挖坑内... 透视辅助"微乐挖坑内购破解"总是存在有辅助教程(哔哩哔哩)1、很好的工具软件,可以解锁游戏的微乐挖坑...
透视科技"诸暨翻财神... 透视科技"诸暨翻财神技术"总是是有辅助方法(哔哩哔哩)该软件可以轻松地帮助玩家将诸暨翻财神技术外卦神...
经调查"微乐小程序黑... 经调查"微乐小程序黑科技下载"竟然真的有辅助工具(哔哩哔哩)1、玩家可以在微乐小程序黑科技下载透视最...
今日"杭州都莱游戏辅... 今日"杭州都莱游戏辅助"其实是真的有辅助攻略(哔哩哔哩)1、杭州都莱游戏辅助脚本辅助下载、杭州都莱游...
最终"蜀渝牌乐汇辅助... 最终"蜀渝牌乐汇辅助"好像是真的有辅助脚本(哔哩哔哩)1、每一步都需要思考,不同水平的挑战蜀渝牌乐汇...