j0j00 / flutter_liquidcore

Node.js virtual machine for Android and iOS in Flutter.
https://pub.dev/packages/flutter_liquidcore
BSD 2-Clause "Simplified" License
67 stars 16 forks source link

Migrate to AndroidX #4

Closed juliocbcotta closed 5 years ago

juliocbcotta commented 5 years ago

Hey, how about to migrate to AndroidX libraries?

j0j00 commented 5 years ago

This requires migrating the underlying library from the support libraries (https://github.com/LiquidPlayer/LiquidCore/tree/master/LiquidCoreAndroid) to AndroidX.

If you can migrate it to AndroidX and generate a clean stable pull-request, then I'm sure the author would be more than happy to merge it.

Once that's done, I can migrate the flutter wrapper to AndroidX as well.

juliocbcotta commented 5 years ago

Actually, we don't need a new version of that version, all you need to do is migrate your deps to AndroidX and use

android.enableJetifier=true
android.useAndroidX=true

in a gradle.properties

More info here https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

j0j00 commented 5 years ago

The main underlying dependency Liquidcore still references support library classes:

So unless that flag changes all the compiled class references to use androidx.* ones, I'm not sure it's going to work?

I tried a quick migration a couple minutes ago, but it kept crashing whenever I ran the example project (due to missing support classes).

j0j00 commented 5 years ago

Actually, just read the documentation a little more carefully:

android.enableJetifier: When set to true, the Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries. The flag is false by default if it is not specified.

I've been out of the loop with the current android-dev ecosystem for a bit, but is there a reason your own project doesn't just specify android.enableJetifier and automatically migrating the flutter_liquidcore and Liquidcore dependencies to AndroidX?

juliocbcotta commented 5 years ago

Jetfier only works in aars and jars. Your plugin is delivered as source code. If your code depends on libs that are aars and they use support library there is no problem. But your code that is compiled in the client developer machine needs to be using AndroidX libraries.

j0j00 commented 5 years ago

Okay, I've gotten it to work now.

The missing class issue must've been because I/Android Studio stripped out the com.android.support:support-v4 dependency during the refactor.

One really annoying thing is that the AndroidX update requires upgrading gradle from 3.2.1 to 3.3.0 (assuming to fix this bug)

However the update to 3.3.0 starts throwing deprecated API warnings on every clean build requiring you to rebuild a second time in order to bypass the warning.

https://github.com/flutter/flutter/issues/28713 - This particular issue was addressed but reverted back.

I think it's fine to move up to 3.3.0 as that's the version which all the AndroidX compatible plugins are using as well.

I always wanted to keep the version parity of this plugin compatible with the main library, but that doesn't look very likely now given that this change will require a major version bump 😢.