dpa99c/cordova-plugin-androidx-adapter

Still cannot build after adding plug in

Closed this issue · 3 comments

I'm submitting a ... (check one with "x"):

  • bug report
  • feature request
  • documentation issue

Bug report

Current behavior:

After adding the project, the configuration works properly and gradle.properties settings are set properly.

However once building in Android Studio, errors still happen while trying to build an APK:

error: package androidx.core.content does not exist

For the following files:

CameraLauncher.java
CordovaUri.java
FileProvider.java
IonicWebViewEngine.java

Expected behavior:

APK should build normally.

Steps to reproduce:

Within a Ionic project do:

cordova plugin add cordova-plugin-androidx

cordova plugin add cordova-plugin-androidx-adapter

ionic cordova prepare android

Then in Android Studio after successfully synced, try to Build Signed Bundle/APK

Environment information

  • Cordova CLI version
    • 9.0.0 (cordova-lib@9.0.1)
  • Cordova platform version
    • Installed: android 8.1.0 / ios 5.1.1
  • Plugins & versions installed in project (including this plugin)
    • call-number 0.0.2 "Cordova Call Number Plugin" cordova-android-support-gradle-release 3.0.0 "cordova-android-support-gradle-release" cordova-clipboard 1.2.1 "Clipboard" cordova-plugin-android-permissions 1.0.0 "Permissions" cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx" cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter" cordova-plugin-camera 4.0.3 "Camera" cordova-plugin-crop 0.3.1 "CropPlugin" cordova-plugin-device 2.0.2 "Device" cordova-plugin-file 5.0.0 "File" cordova-plugin-file-transfer 1.7.1 "File Transfer" cordova-plugin-globalization 1.11.0 "Globalization" cordova-plugin-image-picker 1.1.1 "ImagePicker" cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 2.4.1 "cordova-plugin-ionic-webview" cordova-plugin-jcore 1.2.8 "JCore" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.2.1 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version" jpush-phonegap-plugin 3.6.4 "JPush"
  • Dev machine OS and version, e.g.
    • OSX
      • Mojave

Android build issue:

  • Node JS version
    • 12.1.0
  • Gradle version
    • Gradle 5.4.1
  • Target Android SDK version
    • There is no such property in AndroidManifest.xml
  • Android SDK details
    • sdkmanager --list | sed -e '/Available Packages/q'
      • command returns command not found: sdkmanager
      • Android Studio and SDKs are installed already for other app that uses Android 28 and 29 API levels

Related code:
All provided above.

This is likely a problem with your Android Studio Gradle configuration or caused by a conflict with other plugins in your project (possibly one containing a compiled library with references to the Android Support Library which is not overridable by this plugin) but not a bug with this plugin.

To confirm which please try building in an isolated test project:

cordova create test && cd test
cordova plugin add cordova-plugin-androidx-adapter
cordova platform add android@latest
cordova build android
> Open platforms/android in Android Studio
> DO NOT update Android Gradle Plugin
> Build in Android Studio

The result of this in my dev env using Android Studio 3.5.2 is a successful build:

image

@dpa99c hi,

After trying your command lines seems everything is running correctly in deed:

image

So to make sure I understand this correctly, is this what you are suggesting/saying, or do I misunderstand?

image

If my example works in your dev env then the issue is specific to your project. As to the exact cause, I can only speculate, however I would guess that another plugin is the cause. I would add each plugin one by one to find which is the cause.