当前位置: 首页 > 知识库问答 >
问题:

Android版本升级后不再工作 flutter 包

熊朝
2023-03-14

我刚刚更新了一些flutter软件包。但是,在执行flutter运行时我一直收到此错误。如果我将apk直接安装到设备上,它可以正常工作(这意味着我可以执行flutter build apk),但是,在调试模式下看不到运气。

我最初发布这个帖子时有一个multidex问题,我想我已经通过在build.gradle中将gradle地址更新为4.3.zip解决了这个问题。

任何帮助都将不胜感激。

Remos-MBP:tu_chat remobajwa$ flutter run --debug
Launching lib/main.dart on B1 7A0 in debug mode...
Initializing gradle...                                       1.1s
Resolving dependencies...                                    3.4s
Gradle task 'assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Note: /Users/remobajwa/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/remobajwa/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/android/src/main/java/io/flutter/plugins/firebase/core/FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/remobajwa/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-2.2.0+1/android/src/main/java/io/flutter/plugins/firebasemessaging/FlutterFirebaseInstanceIDService.java usesor overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/remobajwa/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-0.10.0+2/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java uses or overrides a deprecatedAPI.
Note: Recompile with -Xlint:deprecation for details.
/Users/remobajwa/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0-beta01.aar/648ac0c7d224ac70bb13139042d8a76b/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

/Users/remobajwa/Desktop/tu_chat/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values-v28/values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

/Users/remobajwa/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0-beta01.aar/648ac0c7d224ac70bb13139042d8a76b/res/values/values.xml:1304:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

/Users/remobajwa/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0-beta01.aar/648ac0c7d224ac70bb13139042d8a76b/res/values/values.xml:1304:5-69: AAPT: error: resource android:attr/ttcIndex not found.

/Users/remobajwa/Desktop/tu_chat/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
/Users/remobajwa/Desktop/tu_chat/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
/Users/remobajwa/Desktop/tu_chat/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:237: error: resource android:attr/fontVariationSettings not found.
/Users/remobajwa/Desktop/tu_chat/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:237: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Failed to execute aapt
com.android.ide.common.process.ProcessException: Failed to execute aapt
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)
        at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:285)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:109)
        at sun.reflect.GeneratedMethodAccessor406.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
        at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)
        ... 49 more
Caused by: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79)
        at com.android.builder.internal.aapt.v2.QueueableAapt2.lambda$makeValidatedPackage$1(QueueableAapt2.java:179)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        ... 1 more
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
        at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:463)
        at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
        at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
        at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
     *********************************************************
WARNING: This version of google_maps_flutter will break your Android build if it or its dependencies aren't compatible with AndroidX.
         See for more information on the problem and how to fix it.
         This warning prints for all Android build failures. The real root cause of the error may be unrelated.
         *********************************************************

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

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

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

BUILD FAILED in 25s

Gradle task 'assembleDebug'... Done                         26.0s
Gradle task assembleDebug failed with exit code 1

这是我的颤振医生输出

Remos-MBP:tu_chat remobajwa$ flutter doctor -v
[✓] Flutter (Channel beta, v1.0.0, on Mac OS X 10.14 18A391, locale en-CA)
    • Flutter version 1.0.0 at /Users/remobajwa/flutter
    • Framework revision 5391447fae (3 months ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/remobajwa/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Connected device (1 available)
    • B1 7A0 • 841023849815 • android-arm64 • Android 7.0 (API 24)

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

    def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists()) {
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }

    android {
        compileSdkVersion 27
        compileOptions {
            sourceCompatibility 1.8
            targetCompatibility 1.8
        }
        lintOptions {
            disable 'InvalidPackage'
            checkReleaseBuilds false
        }

        defaultConfig {
            // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
            applicationId "tuchat.com"
            minSdkVersion 21
            targetSdkVersion 27
            versionCode 16      // matching ios version
            versionName flutterVersionName
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

        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.release

                // minifyEnabled true
                useProguard true

                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            }
        }
    }

    flutter {
        source '../..'
    }

    dependencies {
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }

    apply plugin: 'com.google.gms.google-services'

android/build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.2.0'
    }
}

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

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

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


subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency {
            details ->
            if (details.requested.group == 'com.android.support'
            && !details.requested.name.contains('multidex')) {
                details.useVersion "26.1.0"
            }
        }
    }
}

这是我从终端输出的.build gradle输出的一部分

-2).
18:07:49.612 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:07:49.612 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
18:07:49.613 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:07:49.613 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
18:07:49.613 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file '/Users/remobajwa/Desktop/tu_chat/android/build.gradle' line: 27
18:07:49.613 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:07:49.613 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
18:07:49.614 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating root project 'android'.
18:07:49.614 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > A problem occurred configuring project ':app'.
18:07:49.614 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]    > Failed to notify project evaluation listener.
18:07:49.614 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]       > Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
18:07:49.615 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
18:07:49.615 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
18:07:49.615 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.

共有1个答案

松雅昶
2023-03-14

几天前我看到了类似的错误,发现我需要升级我的项目来支持AndroidX。

我能够迁移flutter项目来支持AndroidX,而无需使用Android studio。

我是这样做的:

  1. 在内部版本中更新了编译版本。将文件升级到28
  2. 和<code>android。useAndroidX=true和android。在gradle.properties

编辑:如果您看到“无法合并索引”错误,请参见此SO问题,该问题已获得投票通过的解决方案包括(1)尝试清理并重建或(2)在< code>app/build.gradle文件中添加以下内容:

android {
    defaultConfig {
       multiDexEnabled true
    }
}

希望这有帮助!

 类似资料:
  • 我最近更新了我的自制Python 3.8安装。2至3.8。3.做完后,我跑了 以检查是否有任何更新。它更新了我从20.0安装的。2至20.1。1,并且自从我运行该命令以来,在我尝试使用它的任何时候都会抛出一个错误。以下是错误: 升级过程中似乎出现了一些问题,未能更改代码中的版本检查。我看到了类似的问题,但公认的答案对我来说并不适用。如何使再次可用?

  • 我已经将Typo3从版本4升级到版本7,ajaxendpoint不再工作,有人知道typoscript中简单ajaxendpoint定义的使用是否有未记录的更改吗?或者可能是请求的URL现在不同了? 原始定义如下所示: 控制器的简化版本如下所示: 原始请求url为: 指数php?id=176 我仅在调试模式下获得as请求结果: 因此,打字稿的定义似乎在起作用,但似乎有些地方出了问题:( 更新:我找

  • 我已经将flutter升级到1.12.13+hotfix.5,之后我得到的错误是未移植的Android插件版本:3.5.3。 当我将gradle构建降级到3.5.2、3.5.1、3.5.0+时,它会显示以下错误: 完成时出现错误:Gradle构建未能生成。apk文件。这个文件很可能是在C:\users\tiwaria\documents\x-project\build下生成的,但是工具找不到它。

  • 我尝试使用以下命令升级pip3: 安装升级pip 但不幸的是,它不再工作,并显示以下信息: pip3——版本 信息: 回溯(最后一次调用): 文件/usr/local/lib/python3.4/dist-packages/pkg_-resources/init.py”,第651行,在“构建主ws.require(requires) 文件/usr/local/lib/python3.4/dist-

  • 我正在运行《docker compose》中的jenkins,来自图片jenkins/jenkins。升级到Jenkins 2.277.1后,LDAP身份验证停止工作,我无法登录。我收到以下错误: 詹金斯。docker。new\u 1 | 2021 06-04 14:49:31.3110000[id=138]警告o.j.p.p.DiskUsageCollector#collect:无法获取磁盘使用

  • 我已经用flutter在play store上发布了一个应用程序,现在我想上传一个新版本的应用程序。我正在尝试使用以下命令更改版本代码: flutter build apk--Build-Name=1.0.2--Build-Number=3 或者像这样更改local.properties