Coder Social home page Coder Social logo

dpa99c / cordova-plugin-androidx-adapter Goto Github PK

View Code? Open in Web Editor NEW
113.0 5.0 27.0 55 KB

Cordova/Phonegap plugin to migrate any code which references the legacy Android Support Library to the new AndroidX mappings in a Cordova Android platform project.

JavaScript 100.00%

cordova-plugin-androidx-adapter's Introduction

cordova-plugin-androidx-adapter

If your Cordova project contains plugins/libraries which reference both the Android Support Library and AndroidX, your Android build will fail because the two cannot live side-by-side in an Android build.

This plugin provides a shim to migrate references to the legacy Android Support Library to the new AndroidX mappings in a Cordova Android platform project.

This enables a Cordova project for which AndroidX has been enabled (e.g. using cordova-plugin-androidx) to successfully build even if it contains plugins which reference the legacy Support Library.

The plugin uses a hook script to replace any legacy Support Library references:

  • Gradle artifacts in app/build.gradle and project.properties with new artifact mappings
  • Class/package names in AndroidManifest.xml or the Java source code (of Cordova plugins) with new class mappings.

donate

I dedicate a considerable amount of my free time to developing and maintaining this Cordova plugin, along with my other Open Source software. To help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes.

Requirements

This plugin requires a minimum of cordova@8 and cordova-android@8.

Installation

$ cordova plugin add cordova-plugin-androidx-adapter

IMPORTANT: This plugin relies on a Cordova hook script so will not work in Cloud Build environments such as Phonegap Build which do not support Cordova hook scripts.

WARNING: Do not install this plugin in a Cordova project in which AndroidX has not already been enabled or the build will fail.

Usage

Once the plugin is installed it will run on each after_prepare hook in the Cordova build lifecycle, scanning and migrating any references to legacy Support Library entries in the build.gradle or Java source code.

Note: this plugin operates only during the build process and contains no code which is bundled with or executed inside of the resulting Android app produced by the Cordova build process.

Enabling AndroidX

If AndroidX is not already enabled in your Cordova project you can persistently enable it in your Cordova Android platform project by installing my cordova-plugin-androidx plugin.

License

The MIT License

Copyright (c) 2019 Dave Alden / Working Edge Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cordova-plugin-androidx-adapter's People

Contributors

dpa99c avatar timbru31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cordova-plugin-androidx-adapter's Issues

Replace logic replaces only the first occurrence but not all

The current replace just replaces the first occurrence but not all. (see https://github.com/dpa99c/cordova-plugin-androidx-adapter/blob/master/apply.js#L49)

E.g. with this plugin https://github.com/katzer/cordova-plugin-local-notifications/blob/master/src/android/notification/Options.java#L46-L52 only one line is replaced resulting in a build failure.

A PR is incoming, edit: #2
And a BIG thanks for these two plugins, really awesome work!

Still cannot build after adding plug in

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
  • 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.

Is this plugin needed for cordova-android@9

In the readme you explain the need for this plugin as:

This enables a Cordova project for which AndroidX has been enabled (e.g. using cordova-plugin-androidx) to successfully build even if it contains plugins which reference the legacy Support Library.

When navigating to cordova-plugin-androidx I am greeted with the following message:

This plugin is deprecated as it's no longer required since cordova-android@9 adds built-in support for AndroidX.

Does that mean that if I upgrade my app to cordova-android@9 this plugin is also not needed anymore?

[Android] Build failed with cordova-plugin-androidx-adapter

In other plugin uses android.support.v7.widget.GridLayoutManager class, when I run ionic cordova build android, I got failed result.

In class-mappings.json file, android.support.v7.widget.GridLayoutManager convert to androidx.recyclerview.widget.GridLayoutManager, but in my java file it is converted to androidx.gridlayout.widget.GridLayoutManager.

It should covert android.support.v7.widget.GridLayoutManager before android.support.v7.widget.GridLayout.

"android.support.v7.widget.GridLayout": "androidx.gridlayout.widget.GridLayout",
"android.support.v7.widget.GridLayoutManager": "androidx.recyclerview.widget.GridLayoutManager",

Error: Cannot find module 'recursive-readdir'

Bug report

CHECKLIST

  • I have read the issue reporting guidelines

  • I confirm this is a suspected bug or issue that will affect other users

  • I have reproduced the issue using the example projector provided the necessary information to reproduce the issue.

  • I have read the documentation thoroughly and it does not help solve my issue.
  • I have checked that no similar issues (open or closed) already exist.
    Same as Closed issue #7 but since my code runs on a CI I depend on cordova prepare android exiting properly.

Current behavior:
running cordova prepare android fails as the module hook fails with Error: Cannot find module 'recursive-readdir'

Expected behavior:
When doing cordova prepare android the plugin should install as the command should exit cleanly.

Environment information

Installed platforms:
android 8.1.0
  • Plugins & versions installed in project (including this plugin)
code-push 3.0.1 "CodePushAcquisition"
cordova-plugin-androidx 2.0.0 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-firebasex 9.1.2-cli "Google Firebase Plugin"
phonegap-plugin-multidex 1.0.0 "Multidex"
  • Dev machine OS and version: Windows 10 (1909)

Related code:

Cordova prepare android

Console output

cordova-plugin-androidx-adapter: EXCEPTION: Failed to load dependencies: Error: Cannot find module 'recursive-readdir'

Additional Details

  • I've tried to use only firebasex and remove androidx and androidx-adapter from the package.json but that fails too.

Regression in 1.1.2: android.support.v4.app.NotificationCompat.WearableExtender does not seem to be migrated

Bug report

CHECKLIST

  • I have reproduced the issue using the example projector provided the necessary information to reproduce the issue.
  • I have read the documentation thoroughly and it does not help solve my issue.
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:

After upgrading to 1.1.2, I get a build error in my project. 1.1.1 works fine.

Steps to reproduce:

cordova run android

Environment information

  • Cordova CLI version
    • cordova -v 10.0.0
  • Cordova platform version
    • cordova platform ls 9.0.0
  • Plugins & versions installed in project (including this plugin)
    • cordova plugin ls
cordova-background-geolocation-lt 3.9.2 "BackgroundGeolocation"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter"
cordova-plugin-background-fetch 6.1.1 "CDVBackgroundFetch"
cordova-plugin-camera 5.0.0 "Camera"
cordova-plugin-dbcopy 2.1.2 "sqlDB"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-file-opener2 2.1.4 "File Opener2"
cordova-plugin-file-transfer 2.0.0-dev "File Transfer"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 6.0.0 "Splashscreen"
cordova-plugin-statusbar 2.4.4-dev "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-sqlite-evplus-ext-free 0.4.1 "Cordova sqlite storage - free enterprise version [evplus version] with Android performance/memory improvements and TBD other extra features for PhoneGap Build"
cordova-support-google-services 1.3.2 "cordova-support-google-services"
cordova-windows-capability-private-network 1.0.1 "Windows Add internetClientServer and privateNetworkClientServer capabilities"
phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.3.0 "PushPlugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.5 "Launch Navigator"
  • Dev machine OS and version, e.g.
    • OSX
      • sw_vers ProductName: Mac OS X, ProductVersion: 10.15.7, BuildVersion: 19H2

Android build issue:

  • Node JS version
    • node -v 12.16.3
  • Gradle version
    • ls platforms/android/.gradle 6.5.1
  • Target Android SDK version
    • android:targetSdkVersion in AndroidManifest.xml 29
  • Android SDK details
    • sdkmanager --list | sed -e '/Available Packages/q'
Android SDK details
Installed packages:
  Path                                                                              | Version | Description                                     | Location                                                                          
  -------                                                                           | ------- | -------                                         | -------                                                                           
  build-tools;28.0.3                                                                | 28.0.3  | Android SDK Build-Tools 28.0.3                  | build-tools/28.0.3/                                                               
  build-tools;29.0.3                                                                | 29.0.3  | Android SDK Build-Tools 29.0.3                  | build-tools/29.0.3/                                                               
  build-tools;30.0.2                                                                | 30.0.2  | Android SDK Build-Tools 30.0.2                  | build-tools/30.0.2/                                                               
  cmdline-tools;latest                                                              | 2.1     | Android SDK Command-line Tools (latest)         | cmdline-tools/latest/                                                             
  emulator                                                                          | 30.1.5  | Android Emulator                                | emulator/                                                                         
  extras;android;m2repository                                                       | 47.0.0  | Android Support Repository                      | extras/android/m2repository/                                                      
  extras;google;m2repository                                                        | 58      | Google Repository                               | extras/google/m2repository/                                                       
  extras;intel;Hardware_Accelerated_Execution_Manager                               | 7.5.1   | Intel x86 Emulator Accelerator (HAXM installer) | extras/intel/Hardware_Accelerated_Execution_Manager/                              
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2 | 1       | Solver for ConstraintLayout 1.0.2               | extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2/
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2        | 1       | ConstraintLayout for Android 1.0.2              | extras/m2repository/com/android/support/constraint/constraint-layout/1.0.2/       
  patcher;v4                                                                        | 1       | SDK Patch Applier v4                            | patcher/v4/                                                                       
  platform-tools                                                                    | 30.0.4  | Android SDK Platform-Tools                      | platform-tools/                                                                   
  platforms;android-26                                                              | 2       | Android SDK Platform 26                         | platforms/android-26/                                                             
  platforms;android-28                                                              | 6       | Android SDK Platform 28                         | platforms/android-28/                                                             
  platforms;android-29                                                              | 5       | Android SDK Platform 29                         | platforms/android-29/                                                             
  platforms;android-30                                                              | 3       | Android SDK Platform 30                         | platforms/android-30/                                                             
  sources;android-29                                                                | 1       | Sources for Android 29                          | sources/android-29/                                                               
  system-images;android-29;google_apis_playstore;x86                                | 8       | Google Play Intel x86 Atom System Image         | system-images/android-29/google_apis_playstore/x86/                               
  system-images;android-30;google_apis;x86                                          | 8       | Google APIs Intel x86 Atom System Image         | system-images/android-30/google_apis/x86/                                         
  system-images;android-30;google_apis_playstore;x86                                | 8       | Google Play Intel x86 Atom System Image         | system-images/android-30/google_apis_playstore/x86/                               
  tools                                                                             | 26.1.1  | Android SDK Tools                               | tools/                                                                            

Console output

> Task :app:compileDebugJavaWithJavac FAILED
/.../platforms/android/app/src/main/java/com/adobe/phonegap/push/FCMService.java:27: error: package android.support.v4.app.NotificationCompat does not exist
import android.support.v4.app.NotificationCompat.WearableExtender;
                                                ^
/.../platforms/android/app/src/main/java/com/adobe/phonegap/push/FCMService.java:604: error: cannot find symbol
        mBuilder.extend(new WearableExtender().addActions(wActions));
                            ^
  symbol:   class WearableExtender
  location: class FCMService

Hook not executng.

I stumbled upon this weird issue where hook is not executing:

This wont execute the hook:

    <platform name="android">
        <hook type="after_prepare" src="apply.js" />
    </platform>

While this will work (removing platform marker)

    <hook type="after_prepare" src="apply.js" />

I don't have this issue with other plugins, this is weird as the syntax seems to be correct. My colleague has the same issue on the same project.
Cordova@10
cordova-android@9

Could not find any version that matches androidx.legacy:legacy-support-v4:27.+.

_Hi im getting the following error after installing this plugin.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find any version that matches androidx.legacy:legacy-support-v4:27.+.
Versions that do not match:
- 1.0.0
- 1.0.0-rc02
- 1.0.0-rc01
- 1.0.0-beta01
- 1.0.0-alpha3
- + 1 more
Required by:
project :app
Could not find any version that matches androidx.legacy:legacy-support-v4:27.+.
Versions that do not match:
- 1.0.0
- 1.0.0-rc02
- 1.0.0-rc01
- 1.0.0-beta01
- 1.0.0-alpha3
- + 1 more
Required by:
project :app
Could not find any version that matches androidx.appcompat:appcompat:27.+.
Versions that do not match:
- 1.1.0-beta01
- 1.1.0-alpha05
- 1.1.0-alpha04
- 1.1.0-alpha03
- 1.1.0-alpha02
- + 9 more
Required by:
project :app

  • 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._

Android resource linking failed (AAPT: error: resource android:attr/lStar not found)

Hello

Here is our ionic info

Ionic:

Ionic CLI : 6.16.3 (C:\Users\admin\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.4.0
@angular-devkit/build-angular : 0.803.25
@angular-devkit/schematics : 9.0.6
@angular/cli : 8.3.26
@ionic/angular-toolkit : 2.2.0

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 4.2.1, (and 17 other plugins)

Utility:

cordova-res : 0.15.3
native-run : 1.4.0

System:

NodeJS : v14.17.1 (C:\Program Files\nodejs\node.exe)
npm : 6.14.13
OS : Windows 10

here is plugin list which we are using

com.antOnFire.camera-access 0.1 "Check access to camera on a device"
com.markveys.picture-access 0.0.1 "Check access to pictures on a device"
com.phonegap.plugins.nativesettingsopener 1.2.0 "Native settings"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-appinfo 2.1.2 "AppInfo Plugin"
cordova-plugin-calendar 5.1.5 "Calendar"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-keychain-touch-id 3.3.0 "TouchID and Keychain"
cordova-plugin-network-information 3.0.1-dev "Network Information"
cordova-plugin-printer 0.8.0 "Printer"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-uniquedeviceid 1.3.2 "UniqueDeviceID"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-universal-clipboard 0.1.0 "Clipboard"
cordova.plugins.diagnostic 6.0.2 "Diagnostic"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"

All is working fine still last day but after that it fire error when we are trying to create release build like

cordova-plugin-androidx-adapter: Processed 74 source files in 1227ms
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: C:\Users\admin\AppData\Local\Android\sdk
Subproject Path: CordovaLib
Subproject Path: app

Task :app:processReleaseResources FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':app:processReleaseResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
C:\Users\admin.gradle\caches\transforms-2\files-2.1\082fd8435f96aa3f026dd001121230f9\core-1.7.0-beta02\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

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.

Get more help at https://help.gradle.org

BUILD FAILED in 3s
15 actionable tasks: 1 executed, 14 up-to-date
Command failed with exit code 1: D:[user]\platforms\android\gradlew cdvBuildRelease -b D:[user]\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.

cordova.cmd build android --release -- --keystore=instantautosite.keystore --ali... exited with exit code 1.

Re-running this command with the --verbose flag may provide more information.

So can you please help us

Thanks

Fix the PayPal donation button.

I tried to donate by clicking on your PayPal donation button, and it just sat there spinning and did nothing.

So I figured I'd email you. But you didn't provide an email address on this github account. Only a Linkedn address. And when I tried to contact you via LinkedIn, it says I can't unless I sign up for Premium, which I'm not about to do.

So I have literally no other choice but to create a feature-request here on GitHub so maybe you can fix the PayPal donation button so I can contribute to your work.

Thanks.

Handle replacement of support library references in xml resource files

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

  • bug report
  • feature request
  • documentation issue

Feature request

Handle replacement of support library references in xml resource files

Currently, this plugin replaces these library references with a match for java files. There are some instances where these same support libraries are being referenced in xml resource files.

Ex:

<android.support.constraint.ConstraintLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity">

...

Should be replaced with:

<androidx.constraintlayout.widget.ConstraintLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity">

...

This should use the same mappings as the Java files, so it should only take a change to the check for matching files to include .xml suffixed files.

Error: Cannot find module 'recursive-readdir'

  • [X ] bug report
  • feature request
  • documentation issue

Bug report

Hello, not sure if I should submit here or FirebaseX. Here are my plugin

    <plugin name="cordova-plugin-androidx" spec="^1.0.2" />
    <plugin name="cordova-plugin-androidx-adapter" spec="^1.1.0" />
    <plugin name="cordova-plugin-firebasex" spec="^6.1.0" />

When adding a platform doing

cordova platform add android@latest

I get

cordova-plugin-androidx-adapter: EXCEPTION: Failed to load dependencies: Error: Cannot find module recursive-readdir

Complete log

cordova-custom-config: Skipping auto-restore of config file backup(s) cordova-custom-config: Applied custom config from config.xml to [app path]\platforms\android\app\src\main\AndroidManifest.xml cordova-plugin-androidx: Updated gradle.properties to enable AndroidX cordova-plugin-androidx-adapter: EXCEPTION: Failed to load dependencies: Error: Cannot find module 'recursive-readdir' Preparing Firebase on Android
`
I also tried to remove cordova-plugin-androidx from config, removed platform and only added

    <plugin name="cordova-plugin-androidx" spec="^1.0.2" />
    <plugin name="cordova-plugin-firebasex" spec="^6.1.0" />

Then re-added the platform to let firebasex/androidx install androix-adapter by itself, getting the same error

cordova-plugin-androidx-adapter: EXCEPTION: Failed to load dependencies: Error: Cannot find module recursive-readdir

npm 6.10.3
node 10.15.0
9.0.0 ([email protected])

Java source code (of Cordova plugins) are not replace with new class mapping

Hi!
I just found out about the "cordova-plugin-androidx" plugin and this plugin. These 2 plugins should solve my build errors because some of my plugins use Android Support Library and some plugin adds google-play-services witch depends on Support Library. This is the reason for getting duplicate_classes error.
I added this 2 plugins on my project. It seems that "cordova-plugin-androidx" do his job, on gradle.properties I have these 2 lines android.useAndroidX=true android.enableJetifier=true.
But this plugin does not replace the java source code of cordova plugins with the new class mapping (I tried with version 1.1.0). My project is full of errors caused by the imports.
I looked on older version of "cordova-plugin-androidx-adapter" plugin and I saw that it requires cordova@9 , but the last version (1.1.0) requires cordova@8. My project use cordova@8.

Where should be the problem? Is it true that this last version request cordova@8 or it need cordova@9 as the older version?

Error on building : Task :app:compileDebugJavaWithJavac FAILED

Hi, my config is :

Ionic:
Ionic CLI : 5.0.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic1 1.3.1
@ionic/v1-toolkit : 1.0.18

Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 23 other plugins)

Utility:
cordova-res : 0.3.0
native-run : not installed

System:
Android SDK Tools : 26.1.1 (/Users/matthieu/Library/Android/sdk/)
ios-deploy : 1.9.4
ios-sim : 7.0.0
NodeJS : v11.9.0 (/usr/local/Cellar/node/11.9.0/bin/node)
npm : 6.5.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001

The installed plugins :
code-push 2.0.6 "CodePushAcquisition"
cordova-android-firebase-gradle-release 3.0.0 "cordova-android-firebase-gradle-release"
cordova-android-play-services-gradle-release 3.0.0 "cordova-android-play-services-gradle-release"
cordova-android-support-gradle-release 3.0.0 "cordova-android-support-gradle-release"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-cocoapod-supportx 1.6.1 "Cordova CocoaPods Dependency Support"
cordova-plugin-code-push 1.11.19 "CodePush"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-email 1.2.7 "EmailComposer"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-firebasex 2.1.0 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.0 "cordova-plugin-ionic-webview"
cordova-plugin-mauron85-background-geolocation 3.0.1 "CDVBackgroundGeolocation"
cordova-plugin-settings-hook 0.2.7 "Cordova Settings Hooks"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-toast 2.7.2 "Toast"
cordova-plugin-zip 3.1.0 "cordova-plugin-zip"
cordova.plugins.diagnostic 5.0.0 "Diagnostic"

And I get this error :

Task :app:compileDebugJavaWithJavac FAILED
34 actionable tasks: 6 executed, 28 up-to-date
/Users/Sources/platform/mobile/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:49: error: method does not override or implement a method from a supertype
@OverRide
^
/Users/Sources/platform/mobile/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:51: error: cannot find symbol
super.onNewToken(refreshedToken);
^
symbol: method onNewToken(String)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • 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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 6s
/Users/Sources/platform/mobile/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/Sources/platform/mobile/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:49: error: method does not override or implement a method from a supertype
@OverRide
^
/Users/Sources/platform/mobile/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:51: error: cannot find symbol
super.onNewToken(refreshedToken);
^
symbol: method onNewToken(String)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • 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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 6s

I don't understand why I get this error. Thanks for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.