运行“ cordova build android”-AAPT:错误:找不到资源android:attr / fontVariationSettings。 \ n android:attr / ttcIndex找不到

时间:2019-07-24 09:25:29

标签: android cordova ionic-framework gradle

3月,我可以使用命令ionic cordova build android将我的项目很好地构建为apk文件,但是大约4个月无所事事之后,它现在变得无法构建。

我已经研究并跟踪了一些内容,但没有任何效果,包括: Running "cordova build android" - unable to find attribute android:fontVariationSettings and android:ttcIndex

$ ionic -v 5.0.3

$ cordova -v 9.0.0(cordova-lib@9.0.1)

使用依赖项和插件:     “ @ ionic-native / brightness”:“ ^ 4.15.0”,     “ @ ionic-native / core”:“ ^ 4.12.2”,     “ @ ionic-native / firebase”:“ ^ 4.12.0”,     “ @ ionic-native / google-maps”:“ ^ 4.12.0”,     “ @ ionic-native / in-app-browser”:“ ^ 4.12.0”,     “ @ ionic-native / splash-screen”:“〜4.11.0”,     “ @ ionic-native / status-bar”:“〜4.11.0”,     “ @ ionic / storage”:“ 2.1.3”,

"cordova-android": "7.0.0",
"cordova-plugin-brightness": "^0.2.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-firebase": "^1.1.4",
"cordova-plugin-googlemaps": "^2.4.6",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.2.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
C:\Users\bb\.gradle\caches\transforms-1\files-1.1\support-compat-27.1.1.aar\3a6ca51037ab15caf4633bd4cbfb4935\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

C:\Users\bb\.gradle\caches\transforms-1\files-1.1\support-compat-27.1.1.aar\3a6ca51037ab15caf4633bd4cbfb4935\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.

C:\Workspace\myproject\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:95: error: resource android:attr/fontVariationSettings not found.
C:\Workspace\myproject\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:95: 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 java.lang.Thread.run(Thread.java:748)
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)
        ... 47 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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        ... 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:454)
        at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:411)
        at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
        at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)

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 9s
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android exited with exit code 1.

3 个答案:

答案 0 :(得分:1)

尝试转到 platform / android 文件夹并编辑 project.properties 文件,并替换 com.android.support:support-v4:+ < / strong>和 com.android.support:support-v4:27.1.0

这只是解决该问题的一种快速方法,您必须查找使用哪个库引发此错误。

答案 1 :(得分:0)

compileSdkVersion更改为:

compileSdkVersion 28

fontVariationSettingsttcIndex已在api 28级中添加。

答案 2 :(得分:0)

我遵循了这些指南并解决了我的问题。谢谢大家的支持。 https://stackoverflow.com/a/56748258/11663388

https://stackoverflow.com/a/56719078/11663388

cordova plugin remove cordova-plugin-firebase

cordova plugin add cordova-plugin-firebase-lib

ionic cordova platform rm android

ionic cordova platform add android@8.0.0

ionic cordova plugin add cordova-plugin-androidx

ionic cordova plugin add cordova-plugin-androidx-adapter