I now have leaderboards working and I'm happy but I can't get Achievements working. When I call googleplay:reportAchievement(id, steps) my application crashes.
To find out what is happening I need to debug right? Well this leads to my other problem.. debugging doesn't work from Anbdroid Studio.
When I debug to my device the app from inside Android Studio, my google play services login fails, telling me the application is not configured correctly. If I build an APK and install that on my device and then run it, google play logs in just fine.
So because I can't debug the thing from Android Studio, how can I tell what is happening?
Right now I feel I should just remove the Achievement button from my game and give up.
@antix, could you make a sample project with the issue, or give me a few pointers on how to get started to reproduce it ? I never used google play services but I'd like to help
@hgy29 thanks. I don't know if I can pass my project along. I'm using my key to generate a signed APK and if you don't have the same key at your end when you create an APK your app won't be able to even access the Achievements or Leaderboards will it?
I began playing with google play services plugin for android studio, and an automatic plugin integration script is almost ready. It will be in next release, no doubt. You'll have to supply your app id, thats all, gideros will take care of exporting the plugin for you.
I think I'm correct in saying that the next release will be sometime this month.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Oh man, I was messing about with IAB which I also could not get working. I deleted that from my project and now the whole thing fails to flipping compile again.
@billydb have you got the gaming plugin working with achievements? I can call showAchievements() and it shows them. If call reportAchievement() then the app crashes.
@billydb okay, it would be good if somebody else could test these to see if it is just me having the problem.
Last night I figured out something cool in Android Studio so I've posted a tutorial on my devblog that shows you how to use your keystore when debugging to a device in Android Studio. This lets you sign into Google Play Services from the device without the "Your app is not configured" message.
With this working I can now see what is causing the crash when I call reportAchievement()
--------- beginning of crash
07-1422:32:00.76523058-23228/com.antix.falling_animals A/libc: Fatal signal 6(SIGABRT), code -6in tid 23228(GLThread 1329)
To me it looks like some kind of graphic issue? Can anyone shed some light on this?
I have created an entire separate application to test what is happening with Google Play Services. As my other project the results are the same, showLeaderboard() and showAchievements() work fine, but reportAchievement() crashes the app.. Here is a logcat thing..
07-1515:08:53.96917936-18010/com.antix.play_services A/art: art/runtime/check_jni.cc:65]
JNI DETECTED ERROR IN APPLICATION: JNI CallStaticVoidMethodV called with pending exception 'java.lang.NoSuchMethodError' thrown in void com.giderosmobile.android.player.GiderosApplication.nativeDrawFrame():-2
07-1515:08:53.96917936-18010/com.antix.play_services A/art: art/runtime/check_jni.cc:65]incall to CallStaticVoidMethodV
07-1515:08:53.96917936-18010/com.antix.play_services A/art: art/runtime/check_jni.cc:65] from void com.giderosmobile.android.player.GiderosApplication.nativeDrawFrame()-- lots more error lines were in here <img class="emoji" src="https://forum.giderosmobile.com/resources/emoji/smile.png" title=":)" alt=":)" height="20" />
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289]| held mutexes=
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] native: #00 pc 00012960 /system/lib/libc.so (syscall+28)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] native: #01 pc 000aa063 /system/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+98)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] native: #02 pc 001f8f21 /system/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+1036)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] native: #03 pc 001fa41d /system/lib/libart.so (art::Monitor::Wait(art::Thread*, art::mirror::Object*, long long, int, bool, art::ThreadState)+136)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] native: #04 pc 00207609 /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+44)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] native: #05 pc 0000060b /data/dalvik-cache/arm/system@framework@boot.oat (Java_java_lang_Object_wait__JI+102)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] at java.lang.Object.wait!(Native method)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] - waiting on <0x00791f16>(a java.lang.Object)
07-1515:08:54.54117936-18010/com.antix.play_services A/art: art/runtime/runtime.cc:289] at java.lang.Thread.parkFor(Thread.java:1220)--------- beginning of crash
07-1515:08:54.54217936-18010/com.antix.play_services A/libc: Fatal signal 6(SIGABRT), code -6in tid 18010(GLThread 915)
I'm using the gaming plugin which I have working with the latest Google Play Services (9.2.x) in Android Studio. I have a modified (after modifying some of the supplied java files from the allplugins folder). Regardless, this crash is the same as I was getting with the default setup using Play Services 7.8.x
So, is this a bug that has crept into Gideros somewhere along the line?
Looks like there is a definition mismatch between C and Java sides of the reportAchievement() processing. Can you try the following changes in your gaming plugin's Java files and report back ?
In src/com/giderosmobile/android/plugins/gaming/Game.java, around line 240, change:
publicstaticvoid reportAchievement(String type, String id, int numSteps, int immediate)
to
publicstaticvoid reportAchievement(String type, String id, double numSteps, int immediate)
Error:(243, 41)error: incompatible types: possible lossy conversion from double to int
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
:app:compileDebugJavaWithJavac FAILED
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Which is complaining about the numSteps in the code..
public static void reportAchievement(String type, String id, double numSteps, int immediate){
String adp = modifyName(type);if(games.containsKey(adp))
games.get(adp).reportAchievement(id, numSteps, immediate);}
What do you mean by incrementing ? From what I saw in the code google play's achievements have only two states: locked and unlocked, and calling reportAchievement just unlock the achievement
However google's api do have a setSteps() API, don't know if it is something new or not but probably gideros should call this if numSteps>0 instead of unlock
Right. I can report that now the game does not crash when reporting achievements. Unfortunately my game receives no "REPORT_ACHIEVEMENT_COMPLETE" event and when I call showAchievements() there is no progress recorded.
@hgy29, sorry I missed your post about changing the reportAchievement() function, just doing that now..
Changing the code and running crashes the game on launching
--------- beginning of crash
07-1521:05:48.25219115-19115/com.antix.falling_animals E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.antix.falling_animals, PID: 19115
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "lua_canyield" referenced by "libgideros.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:988)
at com.giderosmobile.android.FallingAnimalsActivity.<clinit>(FallingAnimalsActivity.java:28)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1606)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
@antix, this is something else this time, looks like your new project as been exported with 2016.6 in assets only mode. Either switch back to 2016.4 for now or do a clean export with 2016.6 and re-do eventual changes for plugin insertion
Hmm, even after undoing the changes and rebuilding, it crashes on launch now. Maybe this has something to do with updating my Gideros to test the luac.exe thing.
@antix, this is something else this time, looks like your new project as been exported with 2016.6 in assets only mode. Either switch back to 2016.4 for now or do a clean export with 2016.6 and re-do eventual changes for plugin insertion
Snap! So I figure I can just export something with the new version and copy the libs and stuff to my existing project in Android Studio?
Okay that failed. I'm going to get this working in the morning. Thanks so much for all of your help today @hgy29!!
Comments
To find out what is happening I need to debug right? Well this leads to my other problem.. debugging doesn't work from Anbdroid Studio.
When I debug to my device the app from inside Android Studio, my google play services login fails, telling me the application is not configured correctly. If I build an APK and install that on my device and then run it, google play logs in just fine.
So because I can't debug the thing from Android Studio, how can I tell what is happening?
Right now I feel I should just remove the Achievement button from my game and give up.
Likes: antix, Ninjadoodle, SinisterSoft, simwhi
https://deluxepixel.com
Last night I figured out something cool in Android Studio so I've posted a tutorial on my devblog that shows you how to use your keystore when debugging to a device in Android Studio. This lets you sign into Google Play Services from the device without the "Your app is not configured" message.
With this working I can now see what is causing the crash when I call reportAchievement()
So, is this a bug that has crept into Gideros somewhere along the line?
Looks like there is a definition mismatch between C and Java sides of the reportAchievement() processing. Can you try the following changes in your gaming plugin's Java files and report back ?
In src/com/giderosmobile/android/plugins/gaming/Game.java, around line 240, change:
I will check my other code, but at least it;s not crashing now
Likes: antix
Added the event handler and I am not receiving either event (success or fail)
This is my googleplay code..
Changing the code and running crashes the game on launching
Okay that failed. I'm going to get this working in the morning. Thanks so much for all of your help today @hgy29!!