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.

Android / AGK Player and APK File not working

Author
Message
bstebbs
11
Years of Service
User Offline
Joined: 10th Jan 2013
Location:
Posted: 26th Nov 2013 00:33
About 2 months ago, I was unable to get the AppGameKit Player to work on my Android tablet and Android phone. I posted on here and someone suggested I download the latest AppGameKit Player. I did that, installed it on both my tablet and phone and it worked. I now could hit F5 in AppGameKit to publish my game to both the table and phone and my game was now running on both. I was thrilled.

Now forward to today, I have the exact same setup. Same AppGameKit version and same AppGameKit Players. I've updated my app a bit and decided to try to create an APK file. I used the one-click link and after some minor issues, I was able to create the APK file. I decided to see how my game now looks on the tablet and phone and now for some unknown reason, the AppGameKit Players don't seem to run my app on both the tablet and phone. What worked 2 months ago now doesn't work today. The AppGameKit file is right about 40 mb. I know there is a 50 mb limit to use the one-click link so I'm under that. I thought maybe there was an issue with the AppGameKit Player so I was able to inkstall the APK file on the tablet as an actual app. I run it and the same issue. It won't stay running on the tablet either.

What happens is it starts off, shows my introductory screen and during the load process, it just goes away. Goes back to the main screen of the tablet just like the AppGameKit Player does on both the tablet and phone.

Anyone have any idea what is going on here? It's frustrating because I was hoping to be able to have my new app run on these devices and just can't get it to work. I don't get any error message. It just disappears.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Nov 2013 02:30
The Player is not used to run apks built on the web site.

The .apk file is supposed to be installed on your devices and it runs by itself.

Is it possible that you have an issue with the cases in file names or folders? Android is case sensitive. If the actual file is named 'something.png' and you call something like LoadImage("Something.png"), the app on Android will not find it. The same applies to any data files that you read and use. Any file or folder that you use must be spelled with exactly the same case. And Android doesn't like it if there are spaces in directory names.

All these things work when broadcast from your PC to a Player on your device, but not when run directly on them.

It would help if you showed the code that occurs after the introductory screen. If you are trying to open or load something with the wrong file name (case wise counts), then that could be the problem.

I will repeat, the apk file you build on the site is not run through the Player, it runs standalone.

If, when you try to start your app after installing the apk on your device, you see the Player start up, that means your apk was not built properly and the interpreter cannot find your byte code file. The byte code file is the <yourapp>.byc file that you should have been renamed bytecode.byc in the media directory that you zipped up and uploaded. And, the zip file should have included the actual media directory itself, not just the contents of it.

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: 26th Nov 2013 04:51
Quote: "What happens is it starts off, shows my introductory screen and during the load process, it just goes away. Goes back to the main screen of the tablet..."

By this I assume that he's actually seeing part of his own code run for a tick and then the app crashes without warning. If it is indeed just the white AppGameKit Player screen then the bytecode file isn't properly named or the ZIP file is not structured properly (must contain the directory "media" and all files and subdirectories), or it is entirely possible that he has an issue that is similar to mine.

However, this statement give me pause
Quote: "...just like the AppGameKit Player does on both the tablet and phone"

This points more to a mistake in your code.

I cannot use the one-click online builder The bytecode for my project is 27mb and will not run after using the online service to create an APK. I can, however, broadcast it just fine to the player. I can also build it with Eclipse and it runs just fine too.

First, I'd try a small sample project to see if your setup is still working and upload it to the one-click online APK builder to see if everything works. It should. If not, you're probably doing something wrong with the online APK builder somewhere.

If you are getting a crash without warning I have found that this most often happens to me when I've tried to access an array that doesn't exist or go out of bounds on a UDT array. AppGameKit will often run OK in Windows if I go out of bounds on a UDT array, but on Android it crashes immediately with no warning. This is a lot of fun to try to find. I ended up building in "safe guards" for my arrays... really just globals containing the size of each array... not overly efficient, but it works when used carefully.

Other causes could be issues with asset sizes (are any of your sprite sheets bigger than 2048x2048? - not sure of the limit on Android, but it is 1024x1024 on iOS). Have you tested each media file on the device to make sure nothing is wrong with the format? I wrote a simple media tester program that just loads all images in a directory one by one to make sure they're compatible as I've run into issues with that - the issue was something with a progressive JPG... fixed easily by resaving the file.

Anyway that's what comes to the top of my mind. I'm just blowing wind though because I don't know more about your app's setup. Please don't go 2 months of coding without testing your game on a device you intend to release it for, you'll just give yourself nightmares in the end! It's giving me chills just thinking about it.

Let us know if any of this helps.

bstebbs
11
Years of Service
User Offline
Joined: 10th Jan 2013
Location:
Posted: 26th Nov 2013 05:25
Thanks so much for the quick feedback. I will go back and look at all of these comments as soon as I can.

Now, I did go back and look at all of my file names to make sure they are the same case. I did find some that were not. So, I fixed that. I then compiled the program again, did the one-click publish, and copied it to my tablet, ran it again, and got the same result. My introductory screen comes up and then when it's loading in all of the images and music files, it doesn't get to the next screen. Just goes away as if the program was never running. And I did rename the bytecode file to bytecode.byc. Thanks for letting me know that. I didn't know I had to do that.

Regarding testing it on the AppGameKit Player on my tablet and phone, yes I know that I'm not using the APK file through the AppGameKit Player. To use the AppGameKit Player, which is installed on both my tablet and phone, I run it on the device so it's listening and then in my app, I press the F5 key to publish it and then these devices pick it up correctly. Then, the same thing happens. It opens up the intro screen, attempts to load other files, and then disappears as if the app was never running. Closes down the AppGameKit Player all-together.

So, I am back to where I started. And, I will try to publish a test app to make sure the process works correctly. Who knows, maybe I have issues with my tablet and phone. And I do test my app periodically. What I meant is that I hadn't changed my environment in 2 months. My AppGameKit Player on the tablet and phone have been the same for the past 2 months. It was probably a month ago when I last ran the app on the AppGameKit Player and had no problems then. Again, not sure why now it doesn't work.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 26th Nov 2013 05:32
Very glad to hear you weren't coding for two months without testing
It may be the devices, but that would be pretty rare. If you want to upload the apk here or email it too me I'd be happy to give it a go in the morning.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Nov 2013 15:50
If your app crashes when played in the Player, then it is in your code somewhere after the intro screen.

Naphier may be onto the right thing to look at. Arrays and arrays of UDTs can be issues if not handled properly. Accidentally writing after the end of an array will generally crash it.

So, that is probably the first thing to start looking at.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
bstebbs
11
Years of Service
User Offline
Joined: 10th Jan 2013
Location:
Posted: 27th Nov 2013 03:44
SUCCESS!!! I fixed it. Woo-hoo!!!

The problem was a messed up PNG file. That was surprising. At first I thought maybe there was a size limit with PNG files because this was the largest one at 1.99 mb. But once I reduced that, it still didn't work. So, I just replaced it with a different file and everything worked. Took me an hour or more to find the issue as I commented out a lot of code and kept honing in on it until I figured out what code was causing the problem. So, wasn't an array issue, was just a bad PNG file.

But still, this was a great learning experience because I also realized that if the app doesn't work via the AppGameKit Player on one of my devices, then it's also not going to work if I install the APK file on an Android device. So, I kept testing it on my tablet via F5 until I pinpointed the issue.

Thanks also for letting me know I had to change the bytecode name as well. I installed the APK file on the tablet and it works. That's really cool to see. App isn't quite yet ready for prime time but this is promising.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 27th Nov 2013 03:46
Glad to hear you found the problem!

Login to post a reply

Server time is: 2024-03-29 13:44:48
Your offset time is: 2024-03-29 13:44:48