GLBasic forum

Main forum => Beta Tests => Topic started by: Ian Price on 2014-Nov-03

Title: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
I've just got my first proper Android device (ignoring OUYA and GameStick) and have created a small dictionary program for a dyslexic work colleague.

No matter what I do I can't get the .APK to run. It installs, but when run I get an error message - "Unfortunately, dictionary has stopped."

I can install and run the GameStick version of AquaVenture on the device, but this dictionary.apk fails. I've tried cutting the program right back to a white screen saying "Hello" and it still fails.

I've tried signed and unsigned .APKs and ensured that Dev options are on etc. without much luck

Now as I'm new to proper Android I'm sure I've made a mistake somewhere along the line. Can someone test the attached on their device or give an idea why it might be failing.

Many thanks  :nw:
Title: Re: Android help - new device and .APK brings up error message.
Post by: erico on 2014-Nov-03
Hello Ian, I get that error once in a while too.
If it is similar to mine, then here is a quick dirty solution:

Backup your project folder, delete the contents of the ANDROID folder on your dictionary project, copy the contents of the ANDROID compilation folder from a working project (ye aquaventure) to your dictionary one, recompile for android and give it a go.

Your problem might be related to some missing files, the icons for example, of your java version.
Either way, if what I said works (as it does here), then it may be easier for you to figure the problem.

...though I think it must be related to icon files.

Also, look at the compiling window just to make sure you don´t see things like debuf-certificate-expired.

I can send you an apk for testing just to make sure, or you head to the android resolution thread I did a few months ago and give a try on that APK as it should work perfectly. That way you rule out phone configs. 
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
Cheers erico, I'll try that now :)
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
Hmmm. Nope. That didn't work.

I have icon128.png (128x128) and icon.png (512x512) and androidicon.png (72x72) - am I missing others?

No "debuf-certificate-expired" notice either.


[EDIT] BTW it's a small tablet (800x480) if that makes any difference?
Title: Re: Android help - new device and .APK brings up error message.
Post by: erico on 2014-Nov-03
makes no difference.

head here:
http://www.glbasic.com/forum/index.php?topic=9834.15

there is an apk there on the 7th post (also the project).
Give that apk a go, let me know it goes.

That apk worked perfectly on 100% of the many androids I tested and people helped test too.
If it works, take a look at the project, it might make it easier to spot which files are missing.
If none, then it may be something related to the tablet or java.
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
Yep, worked on mine too. Your app doesn't use any AndroidExtras features, so I think I'll try stripping them out of mine and see what gives.

The tablet seems to be working fine (although it couldn't display images uploaded to my Dropbox account - perhaps they were too big or an unsupported format - I noticed your image was a .BMP, mine are .PNG so I'll see if that's the issue (and yes, I've checked case sensitivity)). My Java installation isn't likely to be the issue since I've compiled for OUYA and GameStick without trouble.

It's either something in my code or I've missed something out somewhere.

Cheers erico.

BTW did you test my .APK on your device?
Title: Re: Android help - new device and .APK brings up error message.
Post by: erico on 2014-Nov-03
ops, didn´t notice attachment on the first post. :S

Just gave a go, it installs but when I run it I get the "unfortunately, dictionary has stopped".
It may be something on the code then, check the files on my project (ANDROID FOLDER) against your to see if there is something missing, specially icons.
It could be it.

I have the following files on project root:
icon.ico
androidicon.png
androidicon36.png
androidicon48.png
androidicon96.png
androidiconouya.png
icon.png

I´m attaching them here so you check if that is the issue. (not sure here if all are needed, but my compilations work fine with that)




Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
I've sorted it - it was nothing to do with the icons. :)

Once I'd removed everything AE related from the code it compiled and ran exactly as expected. Hmmmmm

Strange.

Anyway, thanks for your help erico - without your example I would have kept trying with AE. :)
Title: Re: Android help - new device and .APK brings up error message.
Post by: erico on 2014-Nov-03
Good to hear, but we should keep an eye here on why that happened with AE.
Spacefractal should be informed (he probably read this already or will at some point). :good:
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
When I get more time I'll investigate further, but I'm off to work in 10minutes.
Title: Re: Android help - new device and .APK brings up error message.
Post by: spacefractal on 2014-Nov-03
tested it. You are not alone with that extremly stupid error there was one of the AE versions recently. In logcat its wrote its could not locate android_JAVACALL, so none AE functions works at all. For some reasons its was replaced wih the stock version from glbasic, which was uncaugh in a recent version.

If you dont want to download the full thing again (newest update fixed that), then download the zip file here, extract sdl_main.cpp file in the zip to Compiler\platform\android\bin in the  glbasic folder.

Now AE should all works again. Sorry for that bug.
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-03
I'm so glad it wasn't me, although it's usually me finding these bugs! :D

Cheers Alan.
Title: Re: Android help - new device and .APK brings up error message.
Post by: spacefractal on 2014-Nov-03
hehe.

MrPlow did have that issue as well. Its property the most stupid one really. Its the main file that bind AE. That why logcat and adb is important. Here was the output when im tested it:

Code (glbasic) Select

Android Debug Bridge version 1.0.31
List of devices attached
c1607391b81267f device

--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
E/AndroidRuntime( 4443): FATAL EXCEPTION: main
E/AndroidRuntime( 4443): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 4443):        at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 4443):        at java.lang.Class.newInstance(Class.java:1319)
E/AndroidRuntime( 4443):        at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
E/AndroidRuntime( 4443):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2012)
E/AndroidRuntime( 4443):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
E/AndroidRuntime( 4443):        at android.app.ActivityThread.access$600(ActivityThread.java:140)
E/AndroidRuntime( 4443):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
E/AndroidRuntime( 4443):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4443):        at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4443):        at android.app.ActivityThread.main(ActivityThread.java:4895)
E/AndroidRuntime( 4443):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4443):        at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4443):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
E/AndroidRuntime( 4443):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
E/AndroidRuntime( 4443):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 4443): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1307]:   110 cannot locate 'android_JAVACALL'...
E/AndroidRuntime( 4443):
E/AndroidRuntime( 4443):        at java.lang.Runtime.loadLibrary(Runtime.java:370)
E/AndroidRuntime( 4443):        at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime( 4443):        at org.libsdl.app.SDLActivity.<clinit>(SDLActivity.java:188)
E/AndroidRuntime( 4443):        ... 15 more
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-04
Even if I used ADB and Logcat that would mean absolutely nothing to me. Other than soemthing is wrong - and I knew that already! :P
Title: Re: Android help - new device and .APK brings up error message.
Post by: MrPlow on 2014-Nov-08
Great news you having an Android device now...
:)
Title: Re: Android help - new device and .APK brings up error message.
Post by: Ian Price on 2014-Nov-08
Yeah, I guessed it was about time to take the plunge. I also Androidified my TouchPad, so I technically have two devices; one medium 7", one large 10" so hopefully I'll be able to test screen scaling etc.