Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled

This is my Error;

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.fragment:fragment:1.0.0,
androidx.versionedparcelable:versionedparcelable:1.0.0, 
androidx.slidingpanelayout:slidingpanelayout:1.0.0
...

How can i solve this problem? i delete all androidx libraries from my gradle files and my imported libraries from classes. i dont want to use androidx.

like image 549
commandiron Avatar asked Mar 31 '20 18:03

commandiron


3 Answers

The easiest way to do it in a Cordova project is to open your config.xml file and add the following inside the <platform name="android"> tag.

    <preference name="AndroidXEnabled" value="true" />

That way, if you ever remove and re-add the Android platform, you won't have to go back into the gradle.properties and manually edit it. (Besides, my gradle.properties seems to be overwritten every time I type "cordova build android" so editing it directly doesn't work for me anyway.)

Best of luck.

like image 98
Laurence MacNeill Avatar answered Nov 15 '22 09:11

Laurence MacNeill


first Open your Project gradle scripts>> then open gradle.properties And Finally paste this two line code

android.useAndroidX=true

android.enableJetifier=true

enter image description here

like image 34
Sarwar Ahmed Avatar answered Nov 15 '22 08:11

Sarwar Ahmed


  1. Add plugin to enable AndroidX in the project install following,

cordova plugin add cordova-plugin-androidx

  1. Add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX

cordova plugin add cordova-plugin-androidx-adapter

Then build your app.

like image 21
Sameera Damith Avatar answered Nov 15 '22 10:11

Sameera Damith