Sampath
Sampath

Reputation: 65870

Execution failed for task ':app:processDebugResources'. Failed to execute aapt Ionic 4 android

ionic cordova build android --prod

This is the error:

What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

https://developers.google.com/android/guides/releases

The latest update to Google Play services and Firebase includes the following changes:

Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:

Upgrade com.android.tools.build:gradle to v3.2.1 or later. Upgrade compileSdkVersion to 28 or later. Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX. Firebase Bill of Materials (BoM)

Due to the above android SDK change, I cannot build the APK now. I have tried many solutions. But no luck yet. Any clue here?

I have tried this. But it is not working:

build.gradle

project.ext {
  defaultBuildToolsVersion="28.0.0" //String
  defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
  defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
  defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}

project.properties

target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.1=cordova-plugin-firebase/stella-build.gradle
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:16.0.8
cordova.system.library.3=com.google.firebase:firebase-core:16.0.8
cordova.system.library.4=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.5=com.google.firebase:firebase-config:16.4.1
cordova.system.library.6=com.google.firebase:firebase-perf:16.2.4
cordova.system.library.7=com.android.support:support-annotations:28.+

Tried this too. But no luck? i.e. ionic cordova platform add [email protected]

$ ionic cordova platform add [email protected]
> cordova.cmd platform add [email protected] --save
Using cordova-fetch for [email protected]
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.tt.la
        Name: la
        Activity: MainActivity
        Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Subproject Path: CordovaLib
Subproject Path: app
Subproject Path: CordovaLib
Subproject Path: app
Error during processing of action! Attempting to revert...
Uh oh!
ENOENT: no such file or directory, open '\platforms\android\app\src\main\AndroidManifest.xml'

Upvotes: 0

Views: 2120

Answers (1)

Sampath
Sampath

Reputation: 65870

Good news! This is how I have sorted out my issue. It is working fine now.

Note: My problem here was with the Firebase plugin: https://github.com/arnesson/cordova-plugin-firebase

Solution:

1. ionic cordova platform rm android    

2. ionic cordova plugin rm cordova-plugin-firebase

3. ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue 

4. ionic cordova plugin add cordova-plugin-androidx

5. ionic cordova plugin add cordova-plugin-androidx-adapter

6. ionic cordova platform add android

7.ionic cordova build android --prod

Ref: Git Issue

Upvotes: 2

Related Questions