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

Mapbox Android 8.5.0 unstable #263

Closed
AAverin opened this issue Apr 28, 2020 · 21 comments · Fixed by #283
Closed

Mapbox Android 8.5.0 unstable #263

AAverin opened this issue Apr 28, 2020 · 21 comments · Fixed by #283

Comments

@AAverin
Copy link
Contributor

AAverin commented Apr 28, 2020

mapbox/mapbox-android-demo#1280

Looks like Mapbox SDK Android 8.5.0 is unstable, could we roll back to 8.4.0?
Additionally, it would be great if version changes in library dependencies would be published as a different mapbox_gl flutter library version. That way we should be able to roll back if needed.

@m0nac0
Copy link
Collaborator

m0nac0 commented Apr 28, 2020

@AAverin could you check if your issue is the same as #248, and if so also comment over there, please?

@AAverin
Copy link
Contributor Author

AAverin commented Apr 28, 2020

@m0nac0 here is the log I am getting
It doesn't say has unexpected e_machine: 40 (EM_ARM), so the core problem could be similar but specific might be different.
I am also getting my error on emulator, by the way. That's a good point to check, I will test on real device.

D/SoLoader( 2519): init finish: 4 SO sources prepared
D/SoLoader( 2519): init exiting
D/SoLoader( 2519): About to load: libmapbox-gl.so
D/SoLoader( 2519): libmapbox-gl.so not found on /data/data/co.photohound/lib-main
D/SoLoader( 2519): libmapbox-gl.so not found on /data/app/co.photohound-CWTAEuUiGk3Fgzg3VhqpKg==/lib/x86
D/SoLoader( 2519): libmapbox-gl.so not found on /vendor/lib
D/SoLoader( 2519): libmapbox-gl.so not found on /system/lib
E/SoLoader( 2519): couldn't find DSO to load: libmapbox-gl.so
E/Mbgl-LibraryLoader( 2519): Failed to load native shared library.
E/Mbgl-LibraryLoader( 2519): java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libmapbox-gl.so
E/Mbgl-LibraryLoader( 2519): 	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
E/Mbgl-LibraryLoader( 2519): 	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
E/Mbgl-LibraryLoader( 2519): 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
E/Mbgl-LibraryLoader( 2519): 	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxsdk.module.loader.LibraryLoaderProviderImpl$SoLibraryLoader.load(LibraryLoaderProviderImpl.java:42)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxsdk.LibraryLoader.load(LibraryLoader.java:43)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxsdk.net.NativeConnectivityListener.<clinit>(NativeConnectivityListener.java:13)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxsdk.net.ConnectivityReceiver.instance(ConnectivityReceiver.java:43)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxsdk.Mapbox.getInstance(Mapbox.java:67)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxgl.MapboxMapController.<init>(MapboxMapController.java:128)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxgl.MapboxMapBuilder.build(MapboxMapBuilder.java:33)
E/Mbgl-LibraryLoader( 2519): 	at com.mapbox.mapboxgl.MapboxMapFactory.create(MapboxMapFactory.java:37)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:174)
E/Mbgl-LibraryLoader( 2519): 	at android.app.Dialog.dispatchOnCreate(Dialog.java:421)
E/Mbgl-LibraryLoader( 2519): 	at android.app.Dialog.show(Dialog.java:315)
E/Mbgl-LibraryLoader( 2519): 	at android.app.Presentation.show(Presentation.java:250)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:93)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:53)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:105)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:96)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/Mbgl-LibraryLoader( 2519): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/Mbgl-LibraryLoader( 2519): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/Mbgl-LibraryLoader( 2519): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/Mbgl-LibraryLoader( 2519): 	at android.os.Looper.loop(Looper.java:174)
E/Mbgl-LibraryLoader( 2519): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/Mbgl-LibraryLoader( 2519): 	at java.lang.reflect.Method.invoke(Native Method)
E/Mbgl-LibraryLoader( 2519): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/Mbgl-LibraryLoader( 2519): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

@m0nac0
Copy link
Collaborator

m0nac0 commented Apr 28, 2020

Thank you for providing the log, have you tried running flutter build apk --split-per-abi and installing the suitable out of the generated APKs?
I personally haven't experienced these issues yet, but I suspect that flutter has an issue with plugins using external libraries in the form of *.so-files, where flutter includes wrong versions of these external libraries into the APK in some cases. (We have seen similar issues like #45).

@AAverin
Copy link
Contributor Author

AAverin commented Apr 28, 2020

I suppose that 8.5.0 update was pushed to the same 0.0.5 verison of the mapbox_gl library in flutter, because some time ago everything was working. A few variables that, supposedly, changed - Android Studio update and Flutter could have released some minor updates too.
Emulators fail on API 21 and API 28, my device is Android 10 - fails everywhere.

I run via Android Studio and I suppose they are using appbundle there already.

@m0nac0
Copy link
Collaborator

m0nac0 commented Apr 28, 2020

I'm not sure if I understand you correctly, but v0.0.5 of this plugin has come with Mapbox Android SDK 8.5.0 since December 21, 2019, when v0.0.5 was released on pub.dev

@AAverin
Copy link
Contributor Author

AAverin commented Apr 28, 2020

I see. Then either Android Studio update, or flutter or something else in the ecosystem started causing the problem, because I am sure that somewhere in March map was not crashing for me on the Android emulator.

@m0nac0
Copy link
Collaborator

m0nac0 commented Apr 28, 2020

Just to make sure, are you on flutter version 1.12.13+hotfix.9 from the stable channel? And do you now if you updated flutter since it last worked?

@AAverin
Copy link
Contributor Author

AAverin commented Apr 29, 2020

At the moment I am on 1.12.13+hotfix.8 on stable.
I think flutter version was updated a few times since then, at least once when I switched to Android Studio 3.6

@m0nac0
Copy link
Collaborator

m0nac0 commented May 2, 2020

Could you still try what I suggested above, please?
According to https://developer.android.com/studio/run#run-configuration Android Studio should still use APK by default, and the only explanation I can come up with for this error, is that Flutter somehow ships a wrong *.so file.

@AAverin
Copy link
Contributor Author

AAverin commented May 3, 2020

@m0nac0 I can try, but at very best it would solve the issue with local testing. I have the same problem when deploying appbundle to the real device, so I assume problem will also be there in Play Store - already trying to test, but google is very slow to review

@AAverin
Copy link
Contributor Author

AAverin commented May 4, 2020

@m0nac0 Google have just reviewed my app and I can confirm that crash is there on real device when installed via Google Play. I was uploading appbundle to them, so they should have repackaged it to the proper device requirements.

@m0nac0
Copy link
Collaborator

m0nac0 commented May 4, 2020

@AAverin I'm not sure whether the usage of appbundle really makes a difference, because I think the bundletool just e.g. includes whatever *.so file is in the ARM folder in the appbundle and doesn't actually check whether that lib is really compiled for an ARM architecture. But I suspect that the reason for the error is that flutter from the beginning on somehow mixes up the *.so files.
So we'd need to inspect an APK file and check what ABI the included *.so files are actually compiled for. I found the easiest way to do this was running flutter build apk --split-per-abi. Then if the suitable of the generated APKs crashes on your device, you can compare all the generated APKs in the APK inspector tool and if the *.so files in every APK have exactly the same size, you know that most likely flutter (falsely) always included the same *.so files for all the different ABIs.
I hope that makes sense ;)

@AAverin
Copy link
Contributor Author

AAverin commented May 5, 2020

I am using X86 emulator.
Did the split, here is what I get when trying to install x86 apk:
adb: failed to install build/app/outputs/apk/release/app-x86_64-release.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

@AAverin
Copy link
Contributor Author

AAverin commented May 5, 2020

@m0nac0
Copy link
Collaborator

m0nac0 commented May 5, 2020

@AAverin Thank you, I'm afraid though that at this point we can't really do anything here in the flutter plugin to solve this.
A side note though if you want to further investigate this: have you also tried inspecting the APKs with APK Inspector in Android Studio? It might be useful to know whether the native libraries are missing altogether or whether they are just the wrong ones.

@AAverin
Copy link
Contributor Author

AAverin commented May 5, 2020

@m0nac0 Should this issue be escalated to Mapbox Android SDK, rather? It is the one that uses SoLoader which is now buggy.

@m0nac0
Copy link
Collaborator

m0nac0 commented May 5, 2020

@AAverin Yes, please feel free to open an issue over there to ask them to investigate this issue, as this is a community driven project and not an official Mapbox product.

@AAverin
Copy link
Contributor Author

AAverin commented May 5, 2020

@m0nac0 should we maybe rollback flutter library to 8.4.0 version of SDK?

@m0nac0
Copy link
Collaborator

m0nac0 commented May 5, 2020

@AAverin I'm not sure if that would solve anything, as you said that the issue previously wasn't there even with 0.0.5 using SDK 8.5.0?
But you could just test rolling back by changing https://github.com/tobrun/flutter-mapbox-gl/blob/b08dc32816ef4f17b8238d3485a9de419b314c48/android/build.gradle#L40 and if that actually solves the issue, provide a PR. (I think there shouldn't be any breaking changes in the Android SDK affecting us)

@AAverin
Copy link
Contributor Author

AAverin commented May 25, 2020

@m0nac0 There was a fix for this issue in mapbox-android mapbox/mapbox-gl-native-android#111
How does Mapbox SDK versions gets updated in flutter-mapbox-gl? Should I just update and make a PR or someone handles this?

@m0nac0
Copy link
Collaborator

m0nac0 commented May 25, 2020

@AAverin Thank you for keeping track of this! I'm currently testing upgrading the core sdk and the two plugins we are using. If I don't encounter any issues I'll supply a PR for it shortly.

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

Successfully merging a pull request may close this issue.

2 participants