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 / New Android Deployment Guide

Author
Message
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 3rd May 2014 23:42 Edited at: 13th May 2014 08:17
I just put up my personal guide to deploying for Android on Tier 1.
It's been a long time since the original thread was updated and there are some fairly important updates like how to correctly link the FacebookSDK (which seems to be by far the biggest issue). It also includes instructions on how to make it so that your app will be listed as "designed for tablets".
It is my goal to also provide some sample projects that will have new Facebook SDK, Chartboost Ad integration, Google Play Game services (leaderboards, achievements, and login), and Amazon IAP. I hope to make all of these as modular as possible so that you can pick and choose extra features.

http://naplandgames.com/agk

I will also attempt to keep this up to date as things change.

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 4th May 2014 06:09 Edited at: 4th May 2014 06:10
Looks like a great guide!

Have you tried anything with V2 yet regarding Android (or iOS for that matter)? Wondering if you have had luck getting the player/interpreter to work with any of the new V2 samples (Tier 1 or Tier 2).
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 4th May 2014 06:52
No, waiting until it is a out of alpha before anything like that.

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 4th May 2014 09:19
Yes that makes sense, let's just hope the alpha/beta stage of V2 doesn't last as long as the 1.08 beta phase did (1.5 years).
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th May 2014 04:54 Edited at: 6th May 2014 05:21
Updated the guide so that it now also includes how to fix FacebookPostToWall so that it doesn't require a manual login after already calling FacebookLogin.

I also just added in instructions on how to fix app exiting on Android. The END command in Tier 1 does not properly close the app and will often result in an error message on Android. I repurposed AGK's Message() command so that if you call Message("-1") then it will properly close the app without a premature closing notice.

I've also added a short note on integrating Chartboost ads as well as the AGKHelper.java file which includes the fix for Facebook, Chartboost integration, and the fix for app termination. Hopefully more to come soon as I'm pretty anxious to integrate Google Play game services and Amazon IAP. But Amazon IAP will likely be a bear..

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 13th May 2014 08:16
I've added HockeyKid's guide to getting AdMob interstitials to the site as well as some minor updates to the site structure. I'll continue to improve the look over time.

naplandgames.com/agk

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 15th May 2014 00:40
I've made modifications to the app termination procedure for Android.
It now doesn't actually terminate the app, but instead it moves the app to the background. There's also an example of how to use this. This is the preferred method for Android apps because the OS expects it will handle when to actually terminate the app (Android leaves all apps running until memory is needed).

The previous method I had worked fine (act.finish()) with smaller applications, but with larger apps something was not happening correctly with the memory being freed. Also as a developer, you would want the app to retain its state and not fully reboot when your users hit the back key from a main menu. It's a major principle in mobile architecture to not have to reload a frequently used app.

Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
ApkGames.Guru
10
Years of Service
User Offline
Joined: 25th Oct 2013
Location: England, UK
Posted: 22nd May 2014 13:48
Hi, any ideas on how you set the APK minimum version when using the following link? Currently, Google Play says my APK has not been developed for tablets, when they play great on them.

https://developer.thegamecreators.com/android/create_apk.php

Thanks,

[href]www.zortokgames.com[/href]
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 22nd May 2014 18:44
You can't do it with AGKs online tool. You need to go through Eclipse, my guide tells you how. You may also want to upload 2 APKs to Google. One for API 10 (Android 2.3.3) and another for API 11 through latest. That way you have coverage for the widest range and the app is listed as designed for tablets and phones. My guide poutlines it all and many have had better success with it. Feel free to email me directly with questions. I will help.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 27th May 2014 13:57 Edited at: 27th May 2014 19:22
Hi Naphier.

Thank you VERY MUCH for your helpful guide. I have a couple errors returned in eclipse which prevent me from running my app (I'm at STEP 5).

I have red crosses in front of:
myapp/src/com.thegamecreators.agk_player/AGKHelper.java:
import com.facebook.*;
import com.facebook.android.DialogError;
import com.facebook.android.Facebook;
import com.facebook.android.Facebook.DialogListener;
import com.facebook.android.FacebookError;


myapp/src/com.thegamecreators.agk_player/myfacebookactivity.java:
import com.facebook.Session;
import com.facebook.SessionLoginBehavior;
import com.facebook.SessionState;
... and more facebook related line thereafter.

I checked in the properties/android section of my project and facebookSDK is listed as a library (with a green V next to it).
The tooltips for these errors say "the import com.x cannot be resolved".

Do you know what the problem could be?

EDIT:
I've tried a couple things. In "Project/Clean" I ticked "Clean projects selected below" and unchecked "FacebookSDK". I also ticked "Build only selected projects". The errors I mentioned disappeared and I was able to send it on my android device through the "run as android application" command.

The facebook imports are still in the java files and they are not reported as faulty anymore. But since I didn't build the facebookSDK project, I'm not sure if I still have access to facebook features. I can't even check it because I haven't implemeted them yet.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 27th May 2014 19:18
Sometimes you might have to clean/build FacebookSDK project first and then your project. Sometimes you have to right click your project and select Android Tools / Fix Project Properties.
You can just call FacebookLogin in your app to test it out. If you get Facebook dialogue when running the app then it is linked up properly. The dialogue will likely show errors until you set up the app on Facebook.com, but if you see a Facebook window then it is linked.

Quote: "I checked in the properties/android section of my project and facebookSDK is listed as a library (with a green V next to it)."

Also make sure that in the FacebookSDK project properties that the "Is Library" tick box is checked. Maybe try bulding FacebookSDK on its own before building your project? Eclipse can be fickle.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 27th May 2014 19:22 Edited at: 27th May 2014 19:22
Thanks. You posted while I was editing. Here are some results:

"I must have done something wrong. The app runs fine with the automayte builder but with eclipse it's very unstable. When I try to use the volume buttons, the app freezes to death. When using edit boxes, what I type on the keyboard doesn't register. I have to type a letter and then type again in the edit box so that the app registers the sign I typed on the keyboard. Everything works with the automayte builder. It's a real shame because I'd like to have more control on my builds.

I thought I had followed yours instructions to the letter. I installed the jdk1.8.0_05. Could it be the problem? I'll try and start again from scratch but I trully don't understand what went wrong."
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 27th May 2014 19:31
Quote: "When I try to use the volume buttons, the app freezes to death."

That's very strange. Something I've never experienced before. If you have debug mode on for your device you can connect your device through USB while running the app and look at Eclipse logCat to see why the crash is happening.

Keyboard input has almost always been an issue and highly unstable. I can't imagine what Automayte could be doing different that would affect either of these. I had to build my own keyboard input because of AGK's edit box stability is so poor.

I don't think jdk 1.8 would be the problem. It could be something to do with android API targets, but if so it doesn't make a lot of sense.

A few questions:
Are you using the prebuilt interpreter?
What AppGameKit version?

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 27th May 2014 20:19 Edited at: 27th May 2014 20:41
I followed your guide to the letter, except for the cleaning/building part in which I had to uncheck facebookSDK to build without error.

I used the interpreter_android_prebuilt folder as you described. I run agk v1.821.

I'll try to follow your guide through a second time. If it keeps freezing I'll try to debug mode as you suggested.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 27th May 2014 20:46
I've had a few cases where the initial run of the app when launched from Eclipse has a little bit of instability. Never with the volume button, but many many times with the darned keyboard.

Ultimately the keyboard should run as a java activity and use Android UI to work properly, but AppGameKit uses its own keymapping and functionality for this. It shouldn't be unstable, but we found it very often was. We had many users complain that they couldn't log in to our game because the input boxes wouldn't accept characters, the app would crash when you closed the keyboard, the long presses on the keyboard didn't work, the keyboard would become stuck in number mode, on and on. I finally had to build my own sprite-based keyboard and it has never been a problem again.

Whenever running the app from Eclipse, leave the device connected and watch logcat. It will clue in to where the app is failing. It could be very unrelated to the sound button.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 27th May 2014 22:17
When the app misbehaved it was run from the apk on my phone, not from eclipse.

Anyway, I repeated the process on my laptop and compiled an apk. Everything is working fine for the moment on my tablet. I'll try on the phone tomorrow and report back. Thanks for your help!
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 28th May 2014 00:15
Glad it is working. Feel free to shoot me an email if you need one on one help ever.

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 28th May 2014 10:39 Edited at: 28th May 2014 10:41
It works perfectly on my phone (android 2.3) as well.

I did a couple things differently from the first time. Especially related to importing projects.

The first thing I did after importing my project and the facebookSDK was disabling the "build automatically" function. In your excellent tutorial it's written after you instruct us to clean the projects but I believe you may put it way before.

Second thing I did was use the "fix properties" function in the android tools menu for both projects.

Then I checked the android targets and set facebooksdk as libraries for my project.

After that I did the modifications for my project name in the xml and javas.

Then I cleaned and built facebooksdk alone, and I cleaned and built my project alone.

The export went smoothly and the app runs great. Thanks a lot.

I haven't checked the facebook features though. I have yet to understand how to manage things on the facebook side.

By the way, on my first attempt I tried your facebook fix to post properly on the user's wall and eclipse notified me the "authorize" function is deprecated. Is that... important?
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 28th May 2014 11:15
I think I'll make the comment about Build Automatically a bit more prevalent. I may have underestimated its importance. Same thing with the Fix Properties. I don't ever have to use it so I could just be lucky or the first time the FacebookSDK is imported it really needs to have that happen. I'll also make it more clear that FB should be imported first, then built, then do the rest of the imports.

Things aren't difficult to manage on the Facebook side. It can be a little confusing though because they seem to change their app interface every 6 months. Good thing is that when you add or make changes to the app setup on Facebook.com the changes go into affect nearly immediately. So testing changes in real time is a possibility when things don't work.

Yes the version of the authorize method that I use is actually deprecated. I've yet been able to find documentation on how to use the other flavors of it, but it works. Once I figure out how to use the other non-deprecated authorize methods I'll do an update. However, I have major concerns about the Facebook SDK anyway because FB says the lifetime of the SDK is about 2 years from the release dat of the successor SDK. The successor SDK was released in August 2013, so the one we're using will need to be updated by August 2015. There's a bit of time still, but AppGameKit doesn't want to update unless something is broken which means it might be too late by then... I wanted to go through the full upgrade myself, but unfortunately AGK's method for obtaining the friends list is hardcoded into the C++ files and doesn't appear to be accessible through the java files.

Anyway that was more info than is probably needed

TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 28th May 2014 15:00
No, thank you, really. Every bit of information is helpful.

My app is feature complete (except for the translations, I'm waiting for my syster to send me the german translation and and I need to befriend a spanish speaking fella ).

I was reluctant to implement facebook at first but I read that facebook is the best way to advertise your app. I read that testing website suck and many of them aren't free. So I guess I can't avoid facebook if I want my game to be successful.

I also need to implement restrictions for the ad-supported version to encourage people to buy the full game. I see so many reports saying that admob suck that I can't just count on it.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 28th May 2014 21:33
Facebook paid advertising is... well... I'm really suspicious of the results they give us. We track the installs manually and maybe 1 out of 100 clicks on our ads (ads that have the "download" button) actually lead to an install. When individual people share on FB with their friends is when we have the best results. Organic advertising.
AdMob ad campaigns yielded similar results. Basically it seems all paid advertising just stinks unless you have $10,000 to through at it.
However, every time someone shares their score or our app through FB we get a fair amount of clicks and downloads from it. And it was free to us.
For monetization we also found that AdMob was not great. No one clicked on the banner ads. No one. We're moving all of our apps to Chartboost and have about a 10% CTR on the ads. We have actually made money with Chartboost. If a user clicks an ad then installs the app for that ad we get anywhere from $2-$4. We never saw anything like that from AdMob.

Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 17th Jun 2014 10:56
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Aug 2014 17:12
This is a great resource, thanks Naphier.

I am trying to get my tier 2 app released on android, I have followed your guide since it was said somewhere that the process for tier 1 and 2 is similar up to a point.

I am using 108.21 template_android. I have compiled facebook and the template packages and just have warnings as you said I would. So that's the point where you start talking about tier 1 specific stuff like bytecode etc, so I guess I am on my own from here

So I run the project and the virtual device says "Sorry! The application AppGameKit Template(process com.elefantgames.thewormgame) has stopped unexpectedly. Please try again."

The first error after FATAL EXCEPTION: main


Any ideas? Also, am I on the right track? Have people used these templates successfully?

Thanks anyone who can chime in and help me out a little

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 29th Aug 2014 19:28
I do have a tier 2 template all set up and working (I think it only makes a sprite or something, but it works). The setup is basically the same, but you might want to look at the online documentation for AGK. There might be a step in there that is specific to the t2 template that is important. Also you need cygwin.
I've never run into this error before, so I can only guess as to the issue.
1 - Did you compile with cygwin? You'll need cygwin and the latest version of NDK. Cygwin compiles the c++ code for the app.
2 - If you did that then do you have libandroid_player.so in libs/armeabi , libs/armeabi-v7a , and libs/x86 ?
3 - If no lib_android_player.so then check your directory structures and double check the output of cygwin.

That's about all I can think of. Sorry I can't help too much on t2 since I really rarely use it.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Sep 2014 13:23
Thanks Naphier,

I have not compiled with cygwin yet, obviously that is what I need to do next, I thought the template may be pre-compiled and I would not need to compile until I changed something.

I remember trying all this a while back and I could not compile due to permissions issues etc. Hopefully I will have more luck this time around, I will keep you guys informed and hopefully I can help other tier 2 users in the future

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 1st Sep 2014 18:44
cygwin compiling also compiles your main.c
it won't work otherwise


Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 10th Oct 2014 16:44
I got all this working.

You don't need cygwin as long as you don't need to debug, my compile script looks like this:

compile.bat


So for tier 2 users, this thread is a great resource for you too for getting setup with android and facebook etc

Thanks again Naphier

Login to post a reply

Server time is: 2024-04-20 02:39:29
Your offset time is: 2024-04-20 02:39:29