HaxeExtension / extension-googleplaygames

OpenFL extension for Google Play Games / Android
Other
53 stars 17 forks source link

Failed resolution of: Landroid/support/v4/util/ArrayMap; #17

Closed grapefrukt closed 9 years ago

grapefrukt commented 9 years ago

I'm getting this crash as soon as I call extension.gpg.GooglePlayGames.init(false), everything was working previous to upgrading to the latest Android Support Library (23.1.1) and Google Play Services (28).

I'm looking into reverting these upgrades now, but this seems like a problem that will need dealing with eventually.

11-30 16:05:47.618   878   878 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.gpgex.GameHelper.createApiClientBuilder(GameHelper.java:238)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.gpgex.GameHelper.setup(GameHelper.java:278)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.gpgex.GooglePlayGames$1.run(GooglePlayGames.java:56)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:739)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5417)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-30 16:05:47.618   878   878 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.grapefrukt.games.twofold-1/base.apk"],nativeLibraryDirectories=[/data/app/com.grapefrukt.games.twofold-1/lib/arm, /data/app/com.grapefrukt.games.twofold-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
11-30 16:05:47.618   878   878 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-30 16:05:47.618   878   878 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
11-30 16:05:47.618   878   878 E AndroidRuntime:        ... 12 more
11-30 16:05:47.618   878   878 E AndroidRuntime:        Suppressed: java.lang.ClassNotFoundException: android.support.v4.util.ArrayMap
11-30 16:05:47.618   878   878 E AndroidRuntime:                at java.lang.Class.classForName(Native Method)
11-30 16:05:47.618   878   878 E AndroidRuntime:                at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
11-30 16:05:47.618   878   878 E AndroidRuntime:                at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
11-30 16:05:47.618   878   878 E AndroidRuntime:                at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
11-30 16:05:47.618   878   878 E AndroidRuntime:                ... 13 more
11-30 16:05:47.618   878   878 E AndroidRuntime:        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
grapefrukt commented 9 years ago

This error was encountered using haxe 3.2.0, openfl 3.4.0 and lime 2.7.0.

grapefrukt commented 9 years ago

Turns out that manually copying android-support-v4.jar into bin\android\bin\deps\gpgex\libs (where bin is my build folder) does resolve this issue, so it shouldn't be a huge problem to fix.

I am, however not familiar enough with the android build system to know where to add this.

fbricker commented 9 years ago

Hi, you don't need to copy anything. Thing is: To use google play games (you need to have google-play-services_lib and android-support-v4) downloaded into your android SDK Folder (using the android sdk manager) - please read: https://github.com/SempaiGames/extension-googleplaygames/blob/master/README.md#how-to-install

Also, you need to upgrade to the last versions of extension-googleplaygames, extension-googleplayservices-lib and extension-android-support-v4 on haxe (this should be done automatically but running haxelib upgrade).

One thing: I've added missing dependency on this extension (so upgrading the extension may fix your issue right away).

Anyway, having to download this files from the android SDK manager is not something we can fix, as there's something that according to google terms and conditions every developer must do on it's own (really annoying). That's why we cannot include the required JARs from google directly on the extensions (Bad dog Google! bad dog! :-1: )

PS: I think in the future we'll be able to check if those files are already downloaded so we can raise an error in case they're missing telling people exactly what to do :+1: (I'll insist Joshua on that).

Thanks!

grapefrukt commented 9 years ago

I'm sorry! I didn't see the android-support-v4 dependency, I guess I got confused since I had it working and then broke it. Thanks!

fbricker commented 8 years ago

Not your fault :P android-support-v4 was silently added as a dependency few weeks ago by google.