Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if using for target API 28 #1034

Open
arcadesindo opened this issue Jun 23, 2019 · 7 comments
Open

Error if using for target API 28 #1034

arcadesindo opened this issue Jun 23, 2019 · 7 comments

Comments

@arcadesindo
Copy link

Hello I got this issues if combine this plugin with another plugin that need API 28.

I'm using this preference


Project target.

target=android-28
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.google.android.gms:play-services-games:+
cordova.system.library.3=com.google.android.gms:play-services-identity:+
cordova.system.library.4=com.google.android.gms:play-services-auth:+

FAILURE: Build failed with an exception.

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

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/app/INotificationSideChannel;

@shortercode
Copy link

This is caused by Android X compatibility.

The android.support.* libraries have been replaced by androidx.*. Projects will fail to build if you have both, as they declare the same interfaces. The play-services-* libraries were updated on the 17th to use the Android X versions, and this plugin still uses the old ones so you have both in your project. Easiest fix is to use the older version of the play services libs.

I've recently updated some packages for our game engine to work with Android X and developers are having compat. issues with the cordova-plugin-x-socialsharing plugin. We use it for optional features in the engine.

Is there any plan to release an Android X compatible version of the plugin anytime soon? I'm open to submitting a pull request, the change is quite simple. As Android X is an all or nothing change this will likely break compatibility with other plugins...

@pal03377
Copy link

PR #1039 fixes this for me. Please merge it, it is just two lines to check and it just seems to work.

@ankit18singh
Copy link

PR #1039 fixes this for me. Please merge it, it is just two lines to check and it just seems to work.

I tried your MR and it is failing for Ionic 4, with error SystemCookieManager.java uses or overrides a deprecated API

@pal03377
Copy link

I tried your MR and it is failing for Ionic 4, with error SystemCookieManager.java uses or overrides a deprecated API

Is JAVA_HOME defined in your environment? https://stackoverflow.com/a/34216263/4306257

@mifkys
Copy link

mifkys commented Aug 23, 2019

PR #1039 fixes this for me. Please merge it, it is just two lines to check and it just seems to work.

It fails if project has other plugins with android-support-v4 library:

[Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.

java.io.IOException: Can't write [C:\apps\xxx\platforms\android\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\apps\xxx\platforms\android\app\build\intermediates\transforms\desugar\debug\92.jar(;;;;;;**.class)] (Duplicate zip entry [92.jar:android/support/v4/media/MediaBrowserCompat$MediaItem$1.class]))]

@shortercode
Copy link

As Android X is an all or nothing change this will likely break compatibility with other plugins...

The requirement for all plugins to use Android X is frustrating to deal with. The gradle option android.enableJetifier=true is supposed to rewrite 3rd party plugins to be Android X compatible, but I believe it only works with .class files. So it's pretty much useless for the cordova ecosystem. There is a cordova plugin going around which uses a hook to rewrite any imports of the old support lib to Android X, but it's not an ideal situation.

The only alternate solution I can see for libraries is to offer 2 versions, one which is Android X compatible and another which is not. Again, this is far from ideal.

@maxvipon
Copy link

PR #1039 helps me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants