dart Flutter Android构建失败,因为一些工件问题(无法转换活动)

cigdeys3  于 2023-04-03  发布在  Flutter
关注(0)|答案(1)|浏览(301)

我一次又一次地得到这个错误,不知道可能是什么问题,这里是控制台日志,我一次又一次地得到
这个应用程序是一个旧的,我正在更新它成为空安全所有这一切都是工作正常的iOS,但在Android的问题
扑动版本:3.3.7(使用这个,因为我以前更新过这个)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform activity-1.6.1.aar (androidx.activity:activity:1.6.1) to match attributes {artifactType=android-assets, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /Users/moiz/.gradle/caches/modules-2/files-2.1/androidx.activity/activity/1.6.1/23139afb40f2e445f869f2a5f07eb056b1661a3c/activity-1.6.1.aar.
         > Failed to transform '/Users/moiz/.gradle/caches/modules-2/files-2.1/androidx.activity/activity/1.6.1/23139afb40f2e445f869f2a5f07eb056b1661a3c/activity-1.6.1.aar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)
   > Failed to transform annotation-experimental-1.3.0.aar (androidx.annotation:annotation-experimental:1.3.0) to match attributes {artifactType=android-assets, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /Users/moiz/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation-experimental/1.3.0/5087c6f545117dcd474e69e1a93cacec9d7334af/annotation-experimental-1.3.0.aar.
         > Failed to transform '/Users/moiz/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation-experimental/1.3.0/5087c6f545117dcd474e69e1a93cacec9d7334af/annotation-experimental-1.3.0.aar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)

* 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 12m 29s
Exception: Gradle task assembleDebug failed with exit code 1

下面是应用级构建版本。gradle

buildscript {
    ext.kotlin_version = '1.6.0'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.4'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

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

这里是scr/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"
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 33

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.geethen.timeumpire"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    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"
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    implementation "com.android.support:support-v4:28.0.0"
}

Android Gradle更新
./gradlew clean

but5z9lq

but5z9lq1#

解决了这个问题,我已经重新创建了android文件夹,并更新了所有的依赖项
这里的主要问题是关于依赖项不兼容,因此它没有更新到最新版本
检查所有的依赖性和更新到最新的你会得到解决的问题

相关问题