gpt4 book ai didi

android - 找不到 aapt2-proto-7.0.0-beta04-7396180.jar

转载 作者:行者123 更新时间:2023-12-05 05:38:59 25 4
gpt4 key购买 nike

我正在做 Flutter 项目,突然出现这个问题:

Launching lib\main.dart on RMX3031 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_plugin_android_lifecycle:extractDebugAnnotations'.
> Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:detachedConfiguration2'.
> Could not find aapt2-proto-7.0.0-beta04-7396180.jar (com.android.tools.build:aapt2-proto:7.0.0-beta04-7396180).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/7.0.0-beta04-7396180/aapt2-proto-7.0.0-beta04-7396180.jar

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
Exception: Gradle task assembleDebug failed with exit code 1

我搜索了很多,但没有关于这个错误的任何问题。

android/build.gradle:

buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
maven {
url 'http://download.flutter.io'
allowInsecureProtocol = true
}
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

allprojects {
repositories {
google()
mavenCentral()
maven {
url 'http://download.flutter.io'
allowInsecureProtocol = true
}
}

}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}

android/app/build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility "1.8"
targetCompatibility "1.8"
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.supernew"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

我可以手动下载 aapt2-proto-7.0.0-beta04-7396180.jar 但是我如何将它添加到我的 flutter 项目或 gradle 中...

谁能帮我解决这个问题,非常感谢。

最佳答案

删除以下目录的所有内容。

1- C:\Users\USER_NAME.android\build-cache

2- C:\Users\USER_NAME.android\cache

3- C:\Users\USER_NAME.gradle\caches (如果不起作用则可选)

关于android - 找不到 aapt2-proto-7.0.0-beta04-7396180.jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72795797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com