【问题标题】:flutter build apk with errors颤振构建apk有错误
【发布时间】:2020-10-17 19:29:25
【问题描述】:

我在使用flutter build apk 导出APK 文件并安装在安卓设备上时遇到问题。 请问如何解决这个错误。 我但是下面有颤振医生的错误。

注意:在模拟器上运行我的项目时,它可以正常工作,但仅在使用 flutter build apk 导出 APK 时才会出现此错误。

我需要你的帮助,

FAILURE: Build failed with an exception.



* What went wrong:

Execution failed for task ':sms:verifyReleaseResources'.

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

   > 1 exception was raised by workers:

     com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed



     C:\Users\lenovo\.gradle\caches\transforms-2\files-2.1\7b4c54b05abfe32c04b6fb9596cf35c8\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.




     C:\Users\lenovo\.gradle\caches\transforms-2\files-2.1\7b4c54b05abfe32c04b6fb9596cf35c8\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.





* 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 12s




Running Gradle task 'assembleRelease'...                           13.8s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin android_intent...
Running Gradle task 'assembleAarRelease'...                         1.8s
√ Built build\app\outputs\repo.
Building plugin firebase_messaging...
Running Gradle task 'assembleAarRelease'...                     
The plugin firebase_messaging could not be built due to the issue above.
Process finished with exit code 1

颤抖的医生

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Version 10.0.18363.1082], locale ar-IQ)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.3)
[√] IntelliJ IDEA Community Edition (version 2019.2)
[√] VS Code, 64-bit edition (version 1.33.1)
[√] Connected device (1 available)

• No issues found!

【问题讨论】:

    标签: android flutter dart apk


    【解决方案1】:

    原因可能不止一个。因此,您可以遵循以下说明:

    1 - 您可以检查 AndroidX 是否已启用。 android/gradle.properties.android/gradle.properties 必须包含 here 中提到的:

       android.useAndroidX=true
       android.enableJetifier=true
    

    Here 是来源。

    2 - 检查您的 build.gradle 文件。您可能需要评论androidTestImplementationHere 是来源。

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        testImplementation 'junit:junit:4.12'
        // androidTestImplementation 'androidx.test.ext:junit:1.2.1' // <----- Commented this out
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        implementation 'com.google.firebase:firebase-analytics:17.2.0'
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-25
      • 2020-12-18
      • 1970-01-01
      • 2022-01-01
      • 1970-01-01
      • 2021-12-25
      • 2022-01-01
      相关资源
      最近更新 更多