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

Android Google Maps dependency should be "wildcarded" #1

Closed
jonasbark opened this Issue Nov 8, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@jonasbark
Copy link

jonasbark commented Nov 8, 2017

Hi there,

thanks for the plugin! Working well so far.

It seems to be common to use the + wildcard when specifying dependencies in flutter plugins (have a look at all the firebase plugins). This plugin currently hardcodes version 11.0.4:
compile 'com.google.android.gms:play-services-maps:11.0.4'
and the app will crash if you're using 11.+ versions otherwise because of some "class not found" errors.

After changing it to
compile 'com.google.android.gms:play-services-maps:11.+'
the crash is gone.

@matthewtsmith

This comment has been minimized.

Copy link
Member

matthewtsmith commented Nov 8, 2017

Thanks for finding this solution, it's interesting to me that the firebase plugin is doing that. Typically in Android you pin your dependencies so your builds are consistent.

I will make this change as well as add some support for checking for a valid Google Play Service version rather than crashing. Would you mind adding the crash logs you were getting to this ticket for some more context. I'm unable to reproduce this on my various devices and emulators currently.

@matthewtsmith matthewtsmith self-assigned this Nov 8, 2017

@matthewtsmith

This comment has been minimized.

Copy link
Member

matthewtsmith commented Nov 8, 2017

Fixed in 0.0.3

@jonasbark

This comment has been minimized.

Copy link
Author

jonasbark commented Nov 8, 2017

That's the crash log:

I/zygote (30794): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.maps.model.CameraPosition>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/zza;
I/zygote (30794): at void com.apptreesoftware.mapview.MapViewPlugin.() (MapViewPlugin.kt:-1)
I/zygote (30794): at void com.apptreesoftware.mapview.MapViewPlugin.registerWith(io.flutter.plugin.common.PluginRegistry$Registrar) (MapViewPlugin.kt:-1)
I/zygote (30794): at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.plugin.common.PluginRegistry) (GeneratedPluginRegistrant.java:27)
I/zygote (30794): at void com.raisedbythebeat.teacherfinder.MainActivity.onCreate(android.os.Bundle) (MainActivity.kt:11)
I/zygote (30794): at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6998)
I/zygote (30794): at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1230)
I/zygote (30794): at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2899)
I/zygote (30794): at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3046)
I/zygote (30794): at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
I/zygote (30794): at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1688)
I/zygote (30794): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:105)
I/zygote (30794): at void android.os.Looper.loop() (Looper.java:164)
I/zygote (30794): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6809)
I/zygote (30794): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/zygote (30794): at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
I/zygote (30794): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
I/zygote (30794): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.safeparcel.zza" on path: DexPathList[[zip file "/data/app/com.raisedbythebeat.teacherfinder-wP5AE0Y0II37wrLEtVJV1g==/base.apk"],nativeLibraryDirectories=[/data/app/com.raisedbythebeat.teacherfinder-wP5AE0Y0II37wrLEtVJV1g==/lib/arm, /data/app/com.raisedbythebeat.teacherfinder-wP5AE0Y0II37wrLEtVJV1g==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
I/zygote (30794): at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
I/zygote (30794): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
I/zygote (30794): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/zygote (30794): at void com.apptreesoftware.mapview.MapViewPlugin.() (MapViewPlugin.kt:-1)
I/zygote (30794): at void com.apptreesoftware.mapview.MapViewPlugin.registerWith(io.flutter.plugin.common.PluginRegistry$Registrar) (MapViewPlugin.kt:-1)
I/zygote (30794): at void io.flutter.plugins.GeneratedPluginRegistrant.registerWith(io.flutter.plugin.common.PluginRegistry) (GeneratedPluginRegistrant.java:27)
I/zygote (30794): at void com.raisedbythebeat.teacherfinder.MainActivity.onCreate(android.os.Bundle) (MainActivity.kt:11)
I/zygote (30794): at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6998)
I/zygote (30794): at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1230)
I/zygote (30794): at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2899)
I/zygote (30794): at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:3046)
I/zygote (30794): at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
I/zygote (30794): at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1688)
I/zygote (30794): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:105)
I/zygote (30794): at void android.os.Looper.loop() (Looper.java:164)
I/zygote (30794): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6809)
I/zygote (30794): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/zygote (30794): at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
I/zygote (30794): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
I/zygote (30794):
F/flutter (30794): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(31)] Check failed: env->ExceptionCheck() == JNI_FALSE.

I currently use cloud_firestore, firebase_auth, firebase_storage and firebase_messaging plugin, that all rely on some play services / firebase dependencies.

I think the reason for the wildcard usage in firebase plugins is the fact that all plugins can use the same (newest) library version instead of having hardcoded ones that might have different versions as well. To fix that the user would need to "overwrite" the dependency in the apps' build.gradle itself - which is a bit of a hassle if you don't have Android dev experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.