简体   繁体   English

颤振构建 apk 有错误

[英]flutter build apk with errors

I encountered a problem when use flutter build apk to export APK file and install on android device.我在使用flutter build apk导出 APK 文件并在 android 设备上安装时遇到问题。 how to fix this errors please.请如何修复此错误。 i but errors below with flutter doctor.我但是下面的错误与颤振医生有关。

Nots: when run my project on emulator it works properly but this errors appear just when use flutter build apk to export APK.注意事项:在模拟器上运行我的项目时,它可以正常工作,但仅在使用flutter build apk导出 APK 时才会出现此错误。

I need your help,我需要你的帮助,

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

flutter doctor扑医生

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!

There may be more than one reason.原因可能不止一个。 So, these are some instructions that you can follow:因此,您可以遵循以下说明:

1 - You may check if AndroidX is enabled. 1 - 您可以检查是否启用了 AndroidX。 android/gradle.properties or .android/gradle.properties must contain as mentioned in here : android/gradle.properties.android/gradle.properties必须包含这里提到的:

   android.useAndroidX=true
   android.enableJetifier=true

Here is the source. 是来源。

2 - Check your build.gradle file. 2 - 检查您的build.gradle文件。 You may need to comment androidTestImplementation .您可能需要评论androidTestImplementation Here is the source. 是来源。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM