【问题标题】:Getting "Failed to transform libs.jar to match attributes" error when building a release APK构建发布 APK 时出现“无法转换 libs.jar 以匹配属性”错误
【发布时间】:2021-02-22 16:05:00
【问题描述】:

我收到一条错误消息,指出它“无法转换 libs.jar 以匹配属性”,因为“转换的输入文件不存在”。这是在 Flutter 中构建发布 APK 时发生的。

我该如何解决这个问题?

mianumararshad@Mians-MacBook-Pro driverSide % flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Running Gradle task 'assembleRelease'...                                                                      Note: /Users/mianumararshad/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses 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/mianumararshad/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-5.3.2+2/android/src/main/java/com/baseflow/geolocator/tasks/LocationUpdatesUsingLocationManagerTask.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.                                                               
                                                                                                                   
FAILURE: Build failed with an exception.                                                                           
                                                                                                                   
* What went wrong:                                                                                                 
Execution failed for task ':app:lintVitalRelease'.                                                                 
> Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'.                                
   > Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JetifyTransform: /Users/mianumararshad/Downloads/flutter project/roudy/driverSide/build/app/intermediates/flutter/profile/libs.jar.
         > Transform's input file does not exist: /Users/mianumararshad/Downloads/flutter project/roudy/driverSide/build/app/intermediates/flutter/profile/libs.jar. (See https://issuetracker.google.com/issues/158753935)
                                                                                                                   
* 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 6m 25s                                                                                             
Running Gradle task 'assembleRelease'...                                                                           
Running Gradle task 'assembleRelease'... Done                     387.5s (!)

【问题讨论】:

标签: flutter apk release


【解决方案1】:

第 1 步。flutter build apk --debug

第 2 步。flutter build apk --profile

第 3 步。flutter build apk --release

【讨论】:

    【解决方案2】:

    我已经升级了我的 gradle 构建工具3.5.0 -> 4.0.1. 之后我无法制作发布 apk。升级 gradle 构建工具似乎破坏了一些 lints。

    以下解决方案对我有用

    进入android文件夹->app->open build.gradle fine 搜索lintOptions并添加checkReleaseBuilds false示例:

    lintOptions {
            disable 'InvalidPackage'
            checkReleaseBuilds false //Insert this line
        }
    } 
    

    【讨论】:

    • 不确定这是否是好的做法,但嘿,它有效!
    猜你喜欢
    • 2018-06-25
    • 2019-09-26
    • 2017-03-13
    • 1970-01-01
    • 2021-05-18
    • 1970-01-01
    • 2018-08-13
    • 2018-03-31
    • 1970-01-01
    相关资源
    最近更新 更多