EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 906 forks source link

Androidx support #1039

Closed cairin closed 4 years ago

maxvipon commented 4 years ago

This helps with API 28. Thanks!

moconnell9 commented 4 years ago

Please support androidx! My team has no choice but to use it. Thanks :)

jachstet-sea commented 4 years ago

Same here, this plugin has issues with API 28, which is required to upload apps. This PR fixes that, thanks! Please merge :)

Boby commented 4 years ago

is this already merged with the latest plugin? which versions if its merged?

EddyVerbruggen commented 4 years ago

published to npm (5.6.6)

DustinBrett commented 4 years ago

@EddyVerbruggen This update caused my builds to fail with the error Program type already present: android.support.v4.media.MediaBrowserCompat$ConnectionCallback$ConnectionCallbackInternal. Going back to 5.6.5 fixed the issue. I've read of another possible solution here, but I would rather not have to do that unless it's totally necessary.

andersborgabiro commented 4 years ago

5.6.6 doesn't work with API 28 and API 27.

5.6.5 works with both (at least build-wise).

So I understand, does this mean it would not run on Android X?

EddyVerbruggen commented 4 years ago

Maybe one of the others can chime in - I've only merged this of the relative high demand and thumbs up I saw.

jachstet-sea commented 4 years ago

Since we are using the AndroidX-branch, I'm happy to chime in. The problem is that you cannot mix plugins depending on the "legacy" android-support with plugins that used AndroidX. If you do, you will see build failures. As such, going from android-support to AndroidX is a breaking change and maybe should have been released as v6.0.0 instead. That way, most users won't be affected since their current version specification of ^5.X.X won't pull the one with AndroidX automatically. So the easiest fix might be to unpublish v5.6.6 and to re-publish it as v6.0.0.

What we are doing in order to avoid mixing plugins using Android-Support with ones using AndroidX is to additionally use https://www.npmjs.com/package/cordova-plugin-androidx-adapter in our apps. @DustinBrett and @andersborgabiro could you please test if your build works with v5.6.6 and the adapter plugin added as well? Thanks!

andersborgabiro commented 4 years ago

It builds with this, that should pick 5.6.6:

    <plugin name="cordova-plugin-x-socialsharing"/>
    <plugin name="cordova-plugin-androidx-adapter"/>

I don't have anything newer than Android 7 though, so I can't test.

EddyVerbruggen commented 4 years ago

Note that one can't unpublish a release on npm, but reverting and publishing 5.6.7 is no problem, then release 6.0.0 if there is no alternative.

jachstet-sea commented 4 years ago

Agreed, if unpublishing is not possible, that would be the way to go. Then everyone experiencing build failures due to 5.6.6 should be okay and people requiring AndroidX can use v6.x

EddyVerbruggen commented 4 years ago

@jachstet-sea OK, this change has been reverted in 5.6.7, and re-applied in 6.0.0.

I added a note at the top of the readme and both have been pushed to npm.

DustinBrett commented 4 years ago

I was not able to pull 5.6.7 recently in npm. Using 5.6.5 for now still.

DustinBrett commented 4 years ago

@EddyVerbruggen The reason I couldn't get 5.6.7 is I had my package.json pointing directly to this GitHub repo, and this repo doesn't appear to have 5.6.7, whereas npm does.

DustinBrett commented 4 years ago

Now with 5.6.7 on npm I get another error app/src/main/java/nl/xservices/plugins/FileProvider.java:4: error: package androidx.core.content does not exist

EddyVerbruggen commented 4 years ago

@DustinBrett Sorry for that, I missed a file in the revert. 5.6.8 can now be grabbed from either GitHub or npm.

roheel112233 commented 2 years ago

Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback I am getting this error while build an app anyone help how to fix this?

AngelouzCastro commented 2 months ago

How can I get it to work with Android 12?