Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
908 views
in Technique[技术] by (71.8m points)

angular - Ionic App can't build on Android AAPT Error

I am creating a Ionic App, emulating it in Browser works fine, but as soon as i try to build it on android it fails. Looks like some error with AATP, but i cant realy figure out, why this happens... Here is the Error Log:

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 FilesJavajdk1.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:UsersSebastianGoogle DriveGITmyepa_mobileplatformsandroidappuild.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:UsersSebastian.gradlecachesransforms-1files-1.1support-compat-28.0.0-alpha1.aar87f8372badb42114e191aeebff73693e
esvaluesvalues.xml:20:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

C:UsersSebastian.gradlecachesransforms-1files-1.1support-compat-28.0.0-alpha1.aar87f8372badb42114e191aeebff73693e
esvaluesvalues.xml:20:5-70: AAPT: error: resource android:attr/ttcIndex not found.

C:UsersSebastianGoogle DriveGITmyepa_mobileplatformsandroidappuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:141: error: resource android:attr/fontVariationSettings not found.
C:UsersSebastianGoogle DriveGITmyepa_mobileplatformsandroidappuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.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.Executi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Some plugins may encounter incompatibilities due to new updates of Android Support Libraries as explained in other replies here.

Easiest fix is by installing "cordova-android-support-gradle-release" plugin. This plugin will automatically align the version of the plugin which crashed and you can continue to use your plugin.

Also this fix is persistent compared with manually change the version directly into the plugin.

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

Also you may have a look into the documentation and other related issue here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...