扑出错误的构建APK

时间:2020-10-17 19:29:25

标签: android flutter dart apk

使用flutter build apk导出APK文件并在Android设备上安装时遇到问题。 请如何解决此错误。 我,但下面是Flutter Doctor的错误。

不是:在模拟器上运行我的项目时,它可以正常运行,但是仅在使用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!

1 个答案:

答案 0 :(得分:0)

可能有多个原因。因此,您可以按照以下说明进行操作:

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'
}