Ionic App 无法在 Android AAPT 错误上构建
Posted
技术标签:
【中文标题】Ionic App 无法在 Android AAPT 错误上构建【英文标题】:Ionic App can't build on Android AAPT Error 【发布时间】:2018-08-16 04:46:45 【问题描述】:我正在创建一个 Ionic 应用程序,在浏览器中模拟它可以正常工作,但是一旦我尝试在 android 上构建它,它就会失败。看起来 AATP 有一些错误,但我无法弄清楚,为什么会发生这种情况...... 这是错误日志:
Running app-scripts build: --platform android --target cordova
[00:03:39] build dev started ...
[00:03:39] clean started ...
[00:03:39] clean finished in 36 ms
[00:03:39] copy started ...
[00:03:39] deeplinks started ...
[00:03:39] deeplinks finished in 46 ms
[00:03:39] transpile started ...
[00:03:43] transpile finished in 4.22 s
[00:03:43] preprocess started ...
[00:03:43] preprocess finished in 1 ms
[00:03:43] webpack started ...
[00:03:43] copy finished in 4.49 s
[00:03:50] webpack finished in 6.46 s
[00:03:50] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[00:03:51] sass finished in 942 ms
[00:03:51] postprocess started ...
[00:03:51] postprocess finished in 14 ms
[00:03:51] lint started ...
[00:03:51] build dev finished in 11.87 s
> cordova run android
Android Studio project detected
ANDROID_HOME=E:\AndroidSDK
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_c6trj2zw0ratkgf1y8h09dz0v.run(C:\Users\Sebastian\Google Drive\GIT\myepa_mobile\platforms\android\app\build.gradle:144)
[00:03:56] tslint: C:/Users/Sebastian/Google Drive/GIT/myepa_mobile/src/pages/scanner/scanner.ts, line: 24
Property 'alertCtrl' is declared but never used.
L23: private qrScanner: BarcodeScanner,
L24: private alertCtrl: AlertController,
L25: private storage: StorageProvider,
Property 'storage' is declared but never used.
L24: private alertCtrl: AlertController,
L25: private storage: StorageProvider,
L26: private api: ApiProvider,
All imports are unused.
L2: //import NavController, NavParams from 'ionic-angular';
L3: i[00:03:56] tslint: C:/Users/Sebastian/Google Drive/GIT/myepa_mobile/src/pages/scanner/scanner.ts, line: 25
[00:03:56] tslint: ...bastian/Google Drive/GIT/myepa_mobile/src/pages/medicationplan/medicationplan.ts, line: 3
[00:03:56] tslint: C:/Users/Sebastian/Google Drive/GIT/myepa_mobile/src/pages/settings/settings.ts, line: 13
[00:03:56] tslint: C:/Users/Sebastian/Google Drive/GIT/myepa_mobile/src/pages/docs/docs.ts, line: 18
[00:03:56] tslint: C:/Users/Sebastian/Google Drive/GIT/myepa_mobile/src/pages/docs/docs.ts, line: 21
mport BarcodeScanner, BarcodeScannerOptions from "@ionic-native/barcode-scanner";
L4: //import StorageProvider from "../../providers/storage/storage";
Property 'navParams' is declared but never used.
L12: constructor(private navCtrl: NavController,
L13: private navParams: NavParams,
L14: private storage: StorageProvider,
Property 'navParams' is declared but never used.
L17: constructor(private navCtrl: NavController,
L18: private navParams: NavParams,
L19: private api: ApiProvider,
Property 'zone' is declared but never used.
L20: private events: Events,
L21: private zone: NgZone)
L22: events.subscribe("res:update", () =>
[00:03:56] lint finished in 5.12 s
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResourcesC:\Users\Sebastian\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0-alpha1.aar\87f8372badb42114e191aeebff73693e\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\Sebastian\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0-alpha1.aar\87f8372badb42114e191aeebff73693e\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.
C:\Users\Sebastian\Google Drive\GIT\myepa_mobile\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:141: error: resource android:attr/fontVariationSettings not found.
C:\Users\Sebastian\Google Drive\GIT\myepa_mobile\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:141: 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:498)
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) FAILED
25 actionable tasks: 1 executed, 24 up-to-date
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
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)
... 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 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 3s
(node:14708) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
C:\Users\Sebastian\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0-alpha1.aar\87f8372badb42114e191aeebff73693e\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\Sebastian\.gradle\caches\transforms-1\files-1.1\support-compat-28.0.0-alpha1.aar\87f8372badb42114e191aeebff73693e\res\values\values.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.
C:\Users\Sebastian\Google Drive\GIT\myepa_mobile\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:141: error: resource android:attr/fontVariationSettings not found.
C:\Users\Sebastian\Google Drive\GIT\myepa_mobile\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:141: 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:498)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
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)
... 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 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 3s
(node:14708) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
我真的不知道发生了什么,因为今天早些时候构建应用程序运行良好......
我的 Ionic 项目环境信息:
cli packages: (C:\Users\Sebastian\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 browser 5.0.3
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.9.4
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : E:\AndroidSDK
Misc:
backend : pro
编辑:
我通过卸载所有插件并一一安装它们来解决问题。
插件 BarcodeScanner 是问题所在 (here)。在platforms/android/phonegap-plugin-barcodescanner 下的starter-barcodescanner.gradle 文件中将compile 'com.android.support:support-v4:+'
的值更改为compile 'com.android.support:support-v4:23+'
解决了这个问题。
【问题讨论】:
我今天也有同样的问题。我还注意到,如果我删除cordova-plugin-mauron85-background-geolocation
所有构建和部署都很好。
这里同样的问题,也是在过去 24 小时内开始的。 ios构建很好。在过去 3 天里,除了 Java 系统更新之外,我所知道的构建环境没有任何变化。与 OP 相同的 ionic info
,除了:全局:cordova (Cordova CLI):7.0.1 本地包:@ionic/app-scripts:1.3.6 Cordova 平台:.idea android 6.4.0 ios 4.4.0 Ionic Framework:离子角 2.2.0 系统:ios-deploy:1.9.2 ios-sim:6.0.0 节点:v8.4.0 npm:2.15.12 操作系统:macOS Sierra
相同。似乎突然没有对我的开发环境进行任何更新。让我相信有一个隐藏在 Android 构建中的依赖项更新。有趣的是,我还有另一台机器正在正常工作。
这里也一样。今天才开始发生。我系统地删除了我的每个插件,但它没有修复它。一旦我删除了所有这些并删除并添加了平台,那么构建就可以工作了。我尝试删除并添加平台并重新添加所有插件,但它仍然无法正常工作。
【参考方案1】:
如其他回复中所述,由于 Android 支持库的新更新,某些插件可能会遇到不兼容问题。
最简单的解决方法是安装“cordova-android-support-gradle-release”插件。此插件会自动调整崩溃的插件版本,您可以继续使用您的插件。
与手动将版本直接更改到插件相比,此修复是持久的。
cordova plugin add cordova-android-support-gradle-release --fetch
您也可以查看documentation 和其他相关问题here
【讨论】:
在使用Cordova v8.1.1
(操作系统:Ubuntu 18.04)将phonegap-plugin-barcodescanner v8.1.0
添加到Cordova Android 7.1.4
项目后,我得到了dialogCornerRadius not found
。以上解决了我的问题。
非常感谢安德鲁。可能为我节省了许多小时的调试时间!【参考方案2】:
此构建失败是由于 6 月 17 日 Google Play 服务和 Firebase 库的主要版本发布所致。
为我工作
运行:
ionic cordova platform rm android
如果你使用 firebase
cordova plugin remove cordova-plugin-firebase
cordova plugin add cordova-plugin-firebase-lib
运行:
ionic cordova plugin add cordova-plugin-androidx
-
运行:
ionic cordova plugin add cordova-plugin-androidx-adapter
运行:
ionic cordova platform add android@8.0.0
享受你的 apk
ionic cordova build android --prod --release
【讨论】:
【参考方案3】:在核心 Cordova 上,这个插件为我修复了它。
https://github.com/dpa99c/cordova-android-support-gradle-release
【讨论】:
【参考方案4】:我在这里找到了答案:
Build Error -Ionic Cordova fails for android
另外,我的需要与上面类似的修复,只是它在 de.appplant.cordova.plugin.local-notification 插件中。我将'com.android.support:support-v4:+'更改为'com.android.support:support-v4:23+',然后删除并添加了android平台并构建了它。但是,我的 build-extras.gradle 中有一个额外的大括号“”也必须删除。
【讨论】:
【参考方案5】:我可以验证 gradle-plugin 是否已修复它。 之前尝试过支持版本号,但经过 3 周的调试,插件是唯一为我解决的问题!
【讨论】:
以上是关于Ionic App 无法在 Android AAPT 错误上构建的主要内容,如果未能解决你的问题,请参考以下文章