Problem to build android app

Hello.

I have a problem when i try build my project to android native… The message error is this:

cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/zapa/Android/Sdk (recommended setting)
ANDROID_HOME=/home/zapa/Android/Sdk (DEPRECATED)
Using Android SDK: /home/zapa/Android/Sdk
Subproject Path: CordovaLib
Subproject Path: app
Task :app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeDebugResources’.

This project uses AndroidX dependencies, but the ‘android.useAndroidX’ property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.versionedparcelable:versionedparcelable:1.0.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0, androidx.fragment:fragment:1.0.0, androidx.core:core:1.0.0, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.viewpager:viewpager:1.0.0, androidx.collection:collection:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.lifecycle:lifecycle-common:2.0.0, androidx.arch.core:core-common:2.0.0, androidx.annotation:annotation:1.0.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-viewmodel:2.0.0, androidx.lifecycle:lifecycle-livedata-core:2.0.0, androidx.legacy:legacy-support-v4:1.0.0, androidx.media:media:1.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.0.0, androidx.lifecycle:lifecycle-runtime:2.0.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.print:print:1.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

ionic info:

Ionic:

Ionic CLI : 6.10.1 (/usr/lib64/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.1
@angular-devkit/build-angular : 0.901.12
@angular-devkit/schematics : 9.1.12
@angular/cli : 9.1.12
@ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 7 other plugins)

Utility:

cordova-res : 0.15.1
native-run : 1.0.0

System:

Android SDK Tools : 26.1.1 (/home/zapa/Android/Sdk)
NodeJS : v14.4.0 (/usr/bin/node)
npm : 6.14.5
OS : Linux 5.4

some idea?

Me too, I had to make a release today and this stupid error keeps popping up. No fixes around in Google, we need a FIX!!!

Hello.

I have found a solution…only you have to install a plugin to enable androidx dependencies in your IONIC project…

add plugin to enable AndroidX in the project

cordova plugin add cordova-plugin-androidx

add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX

cordova plugin add cordova-plugin-androidx-adapter

Source: Migrating Ionic app to AndroidX

2 Likes

This worked for me. Thanks!

Thanks! That helped me getting further…