web-dev-qa-db-ja.com

cordovaでaaptを実行できませんでした

私はしばらくの間正常に動作しているCordovaプロジェクトに取り組んでいますが、コマンド「cordova run Android」でビルドすると、ビルドが「:app:processArm64DebugResources」に達するたびに非常に奇妙なエラーが発生し始めました_ - 端末"。

プラットフォームの削除と追加、クリーンコマンドの実行、プラグインの更新などを試みました。このエラーはCordovaプロジェクトの1つにのみ影響しますが、他のプロジェクトをビルドしようとしてもエラーはありません。

出力は次のとおりです。

C:\Users\user\.gradle\caches\transforms-1\files-1.1\xwalk_core_library-23.53.589.4.aar\e854897d765996e71d496a6d28135238\res\values\dimens_03.xml:14:5-51: AAPT: error: resource Android:attr/fontVariationSettings not found.

C:\Users\user\.gradle\caches\transforms-1\files-1.1\xwalk_core_library-23.53.589.4.aar\e854897d765996e71d496a6d28135238\res\values\dimens_03.xml:14:5-51: AAPT: error: resource Android:attr/ttcIndex not found.

C:\Users\user\Documents\Coding\Project Grid\grid\platforms\Android\app\build\intermediates\incremental\mergeArm64DebugResources\merged.dir\values\values.xml:100: error: resource Android:attr/fontVariationSettings not found.
C:\Users\user\Documents\Coding\Project Grid\grid\platforms\Android\app\build\intermediates\incremental\mergeArm64DebugResources\merged.dir\values\values.xml:100: 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 com.Android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.Java:551)
        at com.Android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.Java:285)
        at com.Android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.Java:109)
        at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
        at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
        at Java.lang.reflect.Method.invoke(Method.Java:497)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.Java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.Java:173)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:121)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.Java:122)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:107)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:111)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:92)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:70)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:63)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.Java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.Java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.Java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.Java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.Java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.Java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.Java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.Java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.Java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:107)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:124)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:80)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:105)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:99)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.Java:625)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:580)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:99)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.Java:46)
        at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
        at Java.lang.Thread.run(Thread.Java:745)
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)
        ... 48 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 com.Android.builder.internal.aapt.v2.QueueableAapt2$$Lambda$308/383079173.run(Unknown Source)
        at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
        ... 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)
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processArm64DebugResources'.
> 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 1m 23s
32 actionable tasks: 32 executed
(node:6948) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\user\.gradle\caches\transforms-1\files-1.1\xwalk_core_library-23.53.589.4.aar\e854897d765996e71d496a6d28135238\res\values\dimens_03.xml:14:5-51: AAPT: error: resource Android:attr/fontVariationSettings not found.

C:\Users\user\.gradle\caches\transforms-1\files-1.1\xwalk_core_library-23.53.589.4.aar\e854897d765996e71d496a6d28135238\res\values\dimens_03.xml:14:5-51: AAPT: error: resource Android:attr/ttcIndex not found.

C:\Users\user\Documents\Coding\Project Grid\grid\platforms\Android\app\build\intermediates\incremental\mergeArm64DebugResources\merged.dir\values\values.xml:100: error: resource Android:attr/fontVariationSettings not found.
C:\Users\user\Documents\Coding\Project Grid\grid\platforms\Android\app\build\intermediates\incremental\mergeArm64DebugResources\merged.dir\values\values.xml:100: 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 com.Android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.Java:551)
        at com.Android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.Java:285)
        at com.Android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.Java:109)
        at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62)
        at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
        at Java.lang.reflect.Method.invoke(Method.Java:497)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.Java:73)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.Java:173)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:134)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.Java:121)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.Java:122)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:107)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.Java:111)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.Java:92)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.Java:70)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.Java:63)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.Java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.Java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.Java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.Java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.Java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.Java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.Java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.Java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.Java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.Java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.Java:197)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.Java:107)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.Java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.Java:124)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.Java:80)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:105)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.Java:99)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.Java:625)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.Java:580)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.Java:99)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.Java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.Java:46)
        at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.Java:55)
        at Java.lang.Thread.run(Thread.Java:745)
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)
        ... 48 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 com.Android.builder.internal.aapt.v2.QueueableAapt2$$Lambda$308/383079173.run(Unknown Source)
        at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
        ... 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:processArm64DebugResources'.
> 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 1m 23s
27
Melkor

このプラグインをプロジェクトに追加すると、すべてが修正されます

cordova plugin add cordova-Android-support-gradle-release --fetch

これは、Googleが2つの新しいフィールドを追加するAndroid 28 rcに対して行った更新と関係があります。誰かがそれを修正するために世界にプラグインを共有した神に感謝します。

63
Bandito11

here に示されているソリューションを試しましたが、Androidで正常にビルドできました。

file platforms/Android/app/build.gradleを開きます

追加

configurations.all {
    resolutionStrategy {
        force 'com.Android.support:support-v4:27.1.0'
    }
}

dependencies {
    ...
}
19
Nho Huynh

2019年6月17日以降にこの問題に直面した人向け。この問題に何時間も費やした後、最終的に解決策が見つかりました。このビルドの失敗は 2019年6月17日のGoogle Play ServicesおよびFirebaseのメジャーバージョンリリース によるものです

ionic cordova platform rm Android
ionic cordova platform add [email protected] 
ionic cordova plugin add cordova-plugin-androidx 
ionic cordova plugin add cordova-plugin-androidx-adapter

注:これで問題が解決します

注:cordova-plugin-firebaseを使用していてエラーが発生した場合、cordova-plugin-firebasexとして公開され、新しいFirebase SDKによって引き起こされる問題を解決するために修正されたこのプラグインを使用できます。

rm -Rf platforms/Android
cordova plugin rm cordova-plugin-firebase
rm -Rf plugins/ node_modules/
npm install
cordova plugin add cordova-plugin-firebasex
cordova platform add Android

これが役立つことを願っています。

乾杯!

同じエラーが発生しました。私の場合、config.xmlで次の行を削除する必要がありました。

<preference name="Orientation" value="all" />
0
tmuecksch