Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Android APK fails to load on first run beta 19

Author
Message
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Nov 2013 15:43
Okay. Ah, right, I see . I sometimes don't go through a whole thread and sometimes forget the issues.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 5th Nov 2013 15:45
s'alright... this one's gotten messy

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Nov 2013 15:49
what said the seconds if you wrote this at first?
if the result is 0 the os or agk make the long delay.

t#=Timer()
do
print("start time sec.:")
print(t#)
if getpointerpressed()=1 then exit
sync()
loop

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th Nov 2013 17:15
OK so I tried a few things this morning.
This is the code immediately after the includes and variable declarations:


What happens stinks. On Nexus 7 about 3 out of 5 first runs are OK the first timer shows 1.5 seconds on average. On the failed attempts the first timer does not even show, but when I return to the app it shows all of the elapsed time, so the interpreter is up and running and counting time.
On my HTC running android 2.3.4 things are much worse, but similar. If the app fails to load I can return to it and the timer shows the elapsed time, but it never shows the first timer. If it does load then the first timer shows around 3 seconds. If the phone is plugged in to USB and mounted as a disk drive so that I can run Eclipse debugging then the first run of the app fails about 90% of the time. The logcat reports missing images like crazy and file 0 not exist. This is during the first timer before my app calls any file loads.
While the HTC is plugged in and is not mounted as a USB drive it also fails to load on the first run, but does not complain of missing images or file 0 not exists.
I get a lot of messages like this:


I found this in regards to the failed dispatch signal. Those messages are happening when I tap the screen while it is blank.
The app consistently stops at this message on first load:
E/Video(14098): Set Dimensions X:0 Y:0 Width:480 Height:800

I sent an email to Paul on Friday regarding this and haven't heard back yet. I imagine he's deep into v2. My code to have a timed delay on first load has not helped... this is likely due to the app not initiating correctly even before the "please wait" subroutine is even called.


I noticed that I'm using NDK r9 and the instructions say to use r6.
So I downloaded and attempted to do the cygwin compile with r6 and it says that the file main.o is the wrong format and it cannot make libandroid_player.so
Here's the full log


So if I can't compile with NDK r6 then I'm out of ideas.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Nov 2013 19:01
Regarding compiling with NDK r6, this might be a dumb question, but did you clean the project before trying to rebuild it? Typically a compiler won't actually compile the .o file if it is newer than the date of the file to be compiled.

I have been compiling and building using NDK r8e without any problems at all.

About the LogCat messages...
Many of the messages in the LogCat are basically just informative. The ones with '/native-activity' (case sensitive) are generated by AGK.

The ones with '/Surface' look like they are important. As do the 'V/ExtendedExtractor' lines indicating that some library cannot be loaded.

And that fix to android_native_app_glue.c should definitely be made. The version supplied with AppGameKit does only check one thing at a time when the process_input function is called.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Nov 2013 19:03
Update on the android_native_app_glue.c file. Don't simply put the code from the referenced page as a replacement. There are apparently some AppGameKit specific things in that function. I am going to see if I can incorporate the suggested fix and keep the AppGameKit specific stuff there. I will post back here with the fix, if it works.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th Nov 2013 19:13
Yeah, I was using r8 for dFenz, but had a hard drive crash a while ago and decided to reinstall all of the android compiling components so r9 was what was available. Both have worked fine and I'm suspecting that r6 won't work anymore because of changes.

I started from scratch when doing the cygwin compile and just used the original interpreter files.

android_native_app_glue.c
not sure what you're talking about
is that part of this:
Library 'libmmparser.so' not found
and part of the reason that AGKHelper is rejected?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Nov 2013 19:37
The android_native_app_glue.c file is in AGK/IDE/platform/android/Source and is used to 'glue' the compiled code with the Java code (I think).

I just edited my version to include the stuff in this post. I am rebuilding my WIP now and will report if it still works as expected.

The .so files are the *nix version of .dll files for Windows. They are dynamically loaded libraries instead of statically linked ones. The libmmparser.so is something that should be on the Android device.

I've tried googling libmmparser.so to see if I can figure out what it is. Apparently this message pops up a lot for all sorts of people (non-AGK stuff). One post seemed to think it was something to do with permissions and another related to threading issues. It might be related to cameras?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th Nov 2013 23:39
Got a couple new ones today... Game loads OK on the Nexus during first run and then suddenly goes to a black screen... Exit and return and all is fine.
If you get a phone call when you return to the app it is frozen ad you eventually get a force close/wait dialog. Not cool.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Nov 2013 00:26
I just tested an updated version of android_native_app_glue.c that seems to process events better. So far, I've tested it with my WIP on all of my devices.

I uninstalled my WIP from all the devices and then installed the new version from an apk built in Eclipse and copied to the device's Download directory via USB.

In all cases, I opened the app from the installation completion display using the 'open' button. And in all cases, after a brief black screen, the app started up with my splash screen and then behaved properly. And it did not bounce back open after I used the exit button to close it.

I think the updated android_native_app_glue.c has made a difference.

I have attached the file here. It should be placed in <androidpath>/<android-ndk-dir>/sources/android/native_app_glue.

I strongly suggest renaming the android_native_app_glue.c in that directory to something else before putting the attached file there. Just in case we find out that it causes some sort of other issue.

Then you need to do the cygwin build on any projects that you want the apk to be updated. This won't work for the pre-built Player because it does not come with the stuff to build it.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Attachments

Login to view attachments
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 18:20
Well... At first it seemed like that worked for the initial load after install, but after the second test it failed. The app just loads to a black screen. As soon as I exit and return the app runs normally just like before. I don't seem to get any issues now with the app instantly restarting when exited via the exit button, however if I leave the app running, turn the screen off then back on I get a black screen...

It seemed like it was exiting OK, but I just had it instantly reopen when my app found a fatal error and called END...
Paul has suggested to try leaving the bytecode file uncompressed to see if it helps, but the online builder won't correctly build this project (gives my the APK, but it won't install) and I am not sure how to get eclipse to not compress the bytecode file (you can rename the extension to JET - but I'm not sure where in the source code to tell it the bytecode file's extension is actually JET).

Thanks for the try

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Nov 2013 18:33
Naphier, in Eclipse are you using the prebuilt interpreter as your base or the non-prebuilt android_interpreter?

Assuming the non-prebuilt, you can edit <androidpath>/IDE/apps/interpreter/interpreter.cpp and change all instances of 'bytecode.byc' to 'bytecode.jet' (just to make sure that you get the right one), then recompile and it should then use the bytecode.jet file.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 18:36
Yes, non-prebuilt. I'll give that a go. Thanks.
Do you have instructions on how to set up a splash image for android? I notice that when this does load on the android 2.3 devices that it is slow, around 6 seconds, would be nice to show a splash and I think that just calling a load image /sprite will not work well.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Nov 2013 19:47
Yes, I did manage to get a splash working for Android, even including having it come up in landscape mode (which is what my WIP works in).

This thread is where I discuss it.

One of the things to remember is to put the AGKSplash.png file directly in the <andproj>/assets directory, not in the assets/media directory.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 19:54
Leaving the bytecode file uncompressed seems to have worked... the APK is now 4 times bigger, but...trade offs... I think I'd rather have folks see a 30mb download that works on first run vs. an 8 mb download that does nothing after install.
I only had to alter the line in the interpreter.cpp direstly under #ifdef IDE_ANDROID
Change that to bytecode.jet and rename your bytecode file and viola, no compression.
Unfortunately there still seems to be issues with exiting the app on 2.3.4.. now it says force close/wait message...
Getting there!
Thanks for the link on the splash, that will help!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Nov 2013 20:02
In case you didn't notice, you complemented me on the OP for that one.

As always, glad to help.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 20:07
I did see that. How easily I forget. I think at that time I was more worried about orientation than splash as dFenz loaded very fast.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 20:16
Splash works like a charm!
A new issue has popped up though, with the Nexus if you close the keyboard it also appears to be sending a 27 escape key...
I'll have to make some adjustments for that...

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 20:25
Ugh... now the keyboard won't work in android 2.3.4
It opens and when you type nothing happens, switch to a different edit box and then the first letter you typed shows in the box you switched too, but you cant erase it or do anything.
I'm buggin out and can't seem to win!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Nov 2013 20:51
Can you check the LogCat for 'Aborting event'?

When I edited the android_native_app_glue.c file to do multiple checks instead of one (which was the fix recommended) I kept the bits that TGC had added for checking the back key (which registers as escape).

If you edit that file and change 'continue' to 'return' on line 209 (and recompile, sorry), that might fix it. I wasn't sure if 'continue' or 'return' was more appropriate and made a guess.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 21:12
Made the change ... no help
here's the logCat

Still seems to be getting an abort event.

As far as the keyboard issues go with 2.3.4 not getting input correctly I seem to have fixed that. I had followed your setup of the manifest in your thread about the splash and orientation. You had a bunch of orientation settings under different activities. It only needs to be set in the adroid.app.NativeActivity and not in the others. Keeping it to only the native activity seems to have fixed the keyboard input issues on 2.3.4 (not the longpresses and tilda and such, but the inability to input anything I reported just a couple posts ago). So you might want to remove those extra orientation settings in your manifest. They aren't needed to lock in the orientation.

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 21:17
The exiting is not the fault of anything you've done in app glue!!!
It's all because of the Nexus keyboard!
It sends key code 27 if you close the keyboard just like pressing the back key (kinda silly). I can make an adjustment for that!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Nov 2013 21:37
Great! I'm glad you figured things out.

And I will try your suggestion about the AndroidManifest.xml. I'd rather have less in something than more if it is not needed.

The LogCat does show two 'Aborting Event' messages. It indicates that that the 'back' was pressed. I might try a test with Eclipse to see if that is triggered when I press the backspace button on the Nexus keyboard. I need to see if I can find where the constant is defined for AKEYCODE_BACK. I wonder if it conflicts with what AppGameKit expects for the back Android button. The standard ASCII code for a backspace key is 8 and the ASCII code returned for the Android back button is 27. Oh well, something to research later.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 7th Nov 2013 22:31 Edited at: 7th Nov 2013 22:38
Yeah I fixed the login screen so it now requires to back key events to exit, not ideal, but it works... and most people will hit the home key or mash the back key if they don't get out right away anyway.. not a big deal.
So here's an interesting new development. I tried interrupting the app with a phone call to see if that's fixed. Well, the app is responsive when you come back from a phone call, but it thinks there is no internet connection. This persists even after the app is shut down. I had to exit the app and shut off my 3g network and turn it back on to get it to go again... so odd.

EDIT:
Wonkier and wonkier... so if you close the keyboard on the Nexus the app no longer allows you to input text when you select an edit box. Also when attempting to exit via back button after the keyboard had been closed the app gives a wait/force close message... Not a horrible deal, but wonky nontheless.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 7th Nov 2013 23:43
You have my sympathy. Android (which Android?) appears to me to be a disastrous mess. Poor old AppGameKit is trying to deal with fragmented versions of patched-up systems that behave differently on just about every device.

Create your great Android App and look ahead two years. Will it run on everything? I seriously doubt it.

-- Jim - When is there going to be a release?
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 8th Nov 2013 17:36 Edited at: 8th Nov 2013 22:02
Thanks for the sympathy. Things are smoothing out though!

I really think that the issues lie more in the NDK. The more I read about it the more I see where people have had to make all sorts of patches to get certain things to work properly.


EDIT: I wanted to share a few findings here. It appears that whenever an Android 2.3 device is plugged in to a USB that the first run after install hangs even though I've got the bytecode uncompressed. The reason for this is likely that AGK's working directory on 2.3 is on the sdcard. This has been similar whether the device has mounted the sdcard to the PC or if it is simply connected for charging. We found out last night that on my wife's phone (Moto Droid X) that it always mounts the sdcard when plugged in to a PC. The AppGameKit app would not run properly and constantly freeze.

Login to post a reply

Server time is: 2024-05-20 13:28:06
Your offset time is: 2024-05-20 13:28:06