You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/10/13 13:39:31 UTC

[GitHub] [cordova-cli] infacto opened a new issue #536: This project uses AndroidX dependencies, but the ‘android.useAndroidX’ property is not enabled

infacto opened a new issue #536:
URL: https://github.com/apache/cordova-cli/issues/536


   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   
   After migration from Ionic 3 to Ionic 5, the build of the Angular app should work... 
   
   ### What does actually happen?
   
   I cannot build the Android app with the native plugins. See error:
   
   **Error**
   
   ```text
   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.
   ```
   
   I don't want to manipulate the platform files. It's not tracked by git. But how to fix this. :thinking: 
   
   ## More Information / Command / Code / Environment, Platform, Device / Version
   
   **Command**
   
   ```text
   cordova run android
   ```
   
   Please see the embedded files for versions.
   
   <details><summary><strong>Log</strong> - click to expand.</summary><p>
   
   ---
   ```text
   ...
   Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
   > 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.fragment:fragment:1.3.0-alpha08, 
     androidx.slidingpanelayout:slidingpanelayout:1.0.0, 
     androidx.versionedparcelable:versionedparcelable:1.1.0, 
     androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0-alpha07, 
     androidx.annotation:annotation-experimental: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.activity:activity:1.2.0-alpha08, 
     androidx.collection:collection:1.1.0, 
     androidx.viewpager:viewpager:1.0.0, 
     androidx.lifecycle:lifecycle-common:2.3.0-alpha07, 
     androidx.savedstate:savedstate:1.1.0-alpha01, 
     androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, 
     androidx.core:core:1.5.0-alpha02, 
     androidx.arch.core:core-common:2.1.0, 
     androidx.lifecycle:lifecycle-runtime:2.3.0-alpha07, 
     androidx.lifecycle:lifecycle-livedata-core:2.3.0-alpha07, 
     androidx.annotation:annotation:1.2.0-alpha01, 
     androidx.appcompat:appcompat:1.3.0-alpha02, 
     androidx.lifecycle:lifecycle-livedata:2.0.0, 
     androidx.legacy:legacy-support-core-ui:1.0.0, 
     androidx.lifecycle:lifecycle-viewmodel:2.3.0-alpha07, 
     androidx.appcompat:appcompat-resources:1.3.0-alpha02, 
     androidx.legacy:legacy-support-v4:1.0.0, 
     androidx.media:media:1.0.0, 
     androidx.arch.core:core-runtime:2.1.0, 
     androidx.legacy:legacy-support-core-utils:1.0.0, 
     androidx.documentfile:documentfile:1.0.0, 
     androidx.cursoradapter:cursoradapter:1.0.0, 
     androidx.vectordrawable:vectordrawable-animated:1.1.0, 
     androidx.coordinatorlayout:coordinatorlayout:1.0.0, 
     androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, 
     androidx.vectordrawable:vectordrawable:1.1.0, 
     androidx.print:print:1.0.0
   ```
   ---
   </p></details>
   
   
   <details><summary><strong>package.json</strong> - click to expand.</summary><p>
   
   ---
   ```json
   {
     "name": "my-apps",
     "version": "0.0.0",
     "private": true,
     "dependencies": {
       "@angular/animations": "~10.1.1",
       "@angular/common": "~10.1.1",
       "@angular/core": "~10.1.1",
       "@angular/forms": "~10.1.1",
       "@angular/platform-browser": "~10.1.1",
       "@angular/platform-browser-dynamic": "~10.1.1",
       "@angular/router": "~10.1.1",
       "@ionic-native/app-version": "^5.28.0",
       "@ionic-native/battery-status": "^5.28.0",
       "@ionic-native/ble": "^5.28.0",
       "@ionic-native/core": "^5.28.0",
       "@ionic-native/device": "^5.28.0",
       "@ionic-native/device-feedback": "^5.28.0",
       "@ionic-native/diagnostic": "^5.28.0",
       "@ionic-native/email-composer": "^5.28.0",
       "@ionic-native/geolocation": "^5.28.0",
       "@ionic-native/in-app-browser": "^5.28.0",
       "@ionic-native/insomnia": "^5.28.0",
       "@ionic-native/network": "^5.28.0",
       "@ionic-native/splash-screen": "^5.28.0",
       "@ionic-native/status-bar": "^5.28.0",
       "@ionic/angular": "^5.3.2",
       "@ionic/storage": "^2.3.1",
       "@ngx-translate/core": "^13.0.0",
       "@ngx-translate/http-loader": "^6.0.0",
       "rxjs": "~6.6.3",
       "tslib": "^2.0.1",
       "zone.js": "~0.10.3"
     },
     "devDependencies": {
       "@angular-devkit/build-angular": "~0.1001.1",
       "@angular/cli": "~10.1.1",
       "@angular/compiler": "~10.1.1",
       "@angular/compiler-cli": "~10.1.1",
       "@angular/language-service": "~10.1.1",
       "@ionic/angular-toolkit": "^2.3.3",
       "@prettier/plugin-xml": "^0.12.0",
       "@types/jest": "^26.0.13",
       "@types/node": "^12.11.1",
       "@typescript-eslint/eslint-plugin": "^4.2.0",
       "@typescript-eslint/parser": "^4.2.0",
       "codelyzer": "^6.0.0",
       "cordova-android": "^9.0.0",
       "cordova-plugin-app-version": "^0.1.9",
       "cordova-plugin-battery-status": "^2.0.3",
       "cordova-plugin-ble-central": "^1.2.5",
       "cordova-plugin-device": "^2.0.2",
       "cordova-plugin-email-composer": "^0.9.2",
       "cordova-plugin-geolocation": "^4.0.2",
       "cordova-plugin-inappbrowser": "^4.0.0",
       "cordova-plugin-insomnia": "^4.3.0",
       "cordova-plugin-ionic-keyboard": "^2.2.0",
       "cordova-plugin-ionic-webview": "^4.2.1",
       "cordova-plugin-network-information": "^2.0.2",
       "cordova-plugin-splashscreen": "^5.0.2",
       "cordova-plugin-statusbar": "^2.4.2",
       "cordova-plugin-velda-devicefeedback": "0.0.2",
       "cordova-plugin-whitelist": "^1.3.3",
       "cordova-sqlite-storage": "^5.1.0",
       "cordova.plugins.diagnostic": "^6.0.2",
       "eslint": "^7.10.0",
       "jest": "^26.4.2",
       "jest-preset-angular": "^8.3.1",
       "prettier": "^2.1.2",
       "ts-node": "~8.3.0",
       "typescript": "~3.9.5"
     },
     "cordova": {
       "plugins": {
         "cordova-plugin-whitelist": {},
         "cordova-plugin-statusbar": {},
         "cordova-plugin-device": {},
         "cordova-plugin-splashscreen": {},
         "cordova-plugin-ionic-webview": {
           "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
         },
         "cordova-plugin-ionic-keyboard": {},
         "cordova-sqlite-storage": {},
         "cordova-plugin-insomnia": {},
         "cordova-plugin-ble-central": {},
         "cordova.plugins.diagnostic": {
           "ANDROIDX_VERSION": "1.+"
         },
         "cordova-plugin-inappbrowser": {},
         "cordova-plugin-geolocation": {},
         "cordova-plugin-battery-status": {},
         "cordova-plugin-velda-devicefeedback": {},
         "cordova-plugin-app-version": {},
         "cordova-plugin-email-composer": {
           "ANDROID_SUPPORT_V4_VERSION": "27.+"
         },
         "cordova-plugin-network-information": {}
       },
       "platforms": [
         "android"
       ]
     }
   }
   ```
   ---
   </p></details>
   
   <details><summary><strong>config.xml</strong> - click to expand.</summary><p>
   
   ---
   ```xml
   <?xml version='1.0' encoding='utf-8'?>
   <widget id="com.my.app" version="0.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
     <name>MyApp</name>
     <description>Demo</description>
     <author email="me@localhost" href="https://localhost:4200">Me</author>
     <content src="index.html"/>
     <access origin="*"/>
     <allow-intent href="http://*/*"/>
     <allow-intent href="https://*/*"/>
     <allow-intent href="tel:*"/>
     <allow-intent href="sms:*"/>
     <allow-intent href="mailto:*"/>
     <allow-intent href="geo:*"/>
     <allow-navigation href="*"/>
     <preference name="ScrollEnabled" value="false"/>
     <preference name="android-minSdkVersion" value="23"/>
     <preference name="BackupWebStorage" value="none"/>
     <preference name="SplashMaintainAspectRatio" value="true"/>
     <preference name="FadeSplashScreenDuration" value="300"/>
     <preference name="SplashShowOnlyFirstTime" value="false"/>
     <preference name="SplashScreen" value="screen"/>
     <preference name="SplashScreenDelay" value="10000"/>
     <preference name="loadUrlTimeoutValue" value="180000"/>
     <platform name="android">
       <allow-intent href="market:*"/>
       <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png"/>
       <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png"/>
       <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png"/>
       <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png"/>
       <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png"/>
       <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png"/>
       <splash density="ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png"/>
       <splash density="mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png"/>
       <splash density="hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png"/>
       <splash density="xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png"/>
       <splash density="xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png"/>
       <splash density="xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png"/>
       <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png"/>
       <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png"/>
       <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png"/>
       <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png"/>
       <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png"/>
       <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png"/>
       <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png"/>
       <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png"/>
       <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png"/>
       <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png"/>
       <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png"/>
       <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png"/>
       <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
         <application android:usesCleartextTraffic="true"/>
       </edit-config>
       <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/uses-permission" xmlns:android="http://schemas.android.com/apk/res/android">
         <uses-permission android:name="android.permission.INTERNET"/>
         <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
       </edit-config>
     </platform>
     <platform name="ios">
       <allow-intent href="itms:*"/>
       <allow-intent href="itms-apps:*"/>
     </platform>
   </widget>
   ```
   ---
   </p></details>
   
   I'm very exhausted to bring this to life. I appreciate any help. 😓
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-cli] infacto commented on issue #536: This project uses AndroidX dependencies, but the ‘android.useAndroidX’ property is not enabled

Posted by GitBox <gi...@apache.org>.
infacto commented on issue #536:
URL: https://github.com/apache/cordova-cli/issues/536#issuecomment-707762588


   Thank you. I added the preference to enable "AndroidX". But as you predicted, there were some "android.support" errors. 
   Then I added `cordova plugin add cordova-plugin-androidx-adapter` and ... it works. Omg, thank you so much. ❤️ After bugs over bugs in the last days with Angular Mono-Repo, Ionic and Cordova, ... good news and a quick fix feels good. 👍 
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-cli] infacto closed issue #536: This project uses AndroidX dependencies, but the ‘android.useAndroidX’ property is not enabled

Posted by GitBox <gi...@apache.org>.
infacto closed issue #536:
URL: https://github.com/apache/cordova-cli/issues/536


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-cli] breautek commented on issue #536: This project uses AndroidX dependencies, but the ‘android.useAndroidX’ property is not enabled

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #536:
URL: https://github.com/apache/cordova-cli/issues/536#issuecomment-707749378


   You're seeing this error because you have a plugin that depends on androidx support libraries.
   
   As of `cordova-android@9` you can use the `AndroidXEnabled` preference to turn on androidx.
   
   `<preference name="AndroidXEnabled" value="true" />`
   
   When you enable androidx, any code using the old deprecated support libraries **will** break, as the androidx support libraries are incompatible with the old support libraries. You should be able to scan for `android.support` imports across your java source files to determine if there is any code depending on the old support libraries. If you don't have any, then you can probably stop reading.
   
   If you do have old support library references, then you may need to also include the [cordova-plugin-androidx-adapter](https://www.npmjs.com/package/cordova-plugin-androidx-adapter) plugin to upgrade any other plugins that are still using the old support libraries. Mileage may vary.
   
   Let me know if this helps.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org