Reputation: 1473
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.
Upvotes: 11
Views: 41238
Reputation: 794
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.
Upvotes: 29
Reputation: 712
first Open your Project gradle scripts>> then open gradle.properties And Finally paste this two line code
android.useAndroidX=true
android.enableJetifier=true
Upvotes: 20
Reputation: 613
cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter
Then build your app.
Upvotes: 5
Reputation: 59
The Android Gradle plugin provides the following global flags that you can set in your gradle.properties
file:
android.useAndroidX
: When set to true, this flag indicates that you want to start using AndroidX from now on.
If the flag is absent, Android Studio behaves as if the flag were set to false.
Therefore use this plugin android.useAndroidX=true
in gradle.properties
and sync project.
This should solve your problem.
Upvotes: 2