Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Initial Android port committed to subversion

This thread is locked; no one can reply to it. rss feed Print
Initial Android port committed to subversion
J-Gamer
Member #12,491
January 2011
avatar

I always perform a clean before rebuilding...

I guess I'll have to rebuild allegro when I change those files?

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

J-Gamer said:

I guess I'll have to rebuild allegro when I change those files?

A 'make && make install' should do the trick. Then of course, copy the libs back into your jni folder.

I really do suggest trying to get that run.sh script to work with your setup. It really is quite handy. It handles all the stages of getting the android example compiled, installed, and running on the device with one command.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

I got the exact same error. When I built Allegro, it was not a debug build so I had liballegro.so etc. I edited AllegroActivity.java and removed the -debug on those two lines and it worked. But make sure you're copying the shared libraries into jni/armeabi*.

Thomas Fjellstrom
Member #476
June 2000
avatar

I got the exact same error. When I built Allegro, it was not a debug build so I had liballegro.so etc. I edited AllegroActivity.java and removed the -debug on those two lines and it worked. But make sure you're copying the shared libraries into jni/armeabi*.

I was pretty sure he did all that, hence my confusion.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

Just double checking. It's easy to forget something when all the steps are new to you. I had to rebuild everything from scratch a few times to get it to work on my device.

Thomas Fjellstrom
Member #476
June 2000
avatar

You don't want to know how many times I've had to build it ;D

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

J-Gamer
Member #12,491
January 2011
avatar

Now it won't even install... Although I have "Accept unknown sources" on. *****

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

Have you been able to try the run.sh script at all? Or something similar that would work in windows, if you use windows? It will need modifications regardless of which OS you use.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

J-Gamer
Member #12,491
January 2011
avatar

I managed to get the run.sh to work(changed a few names in there, and it runs), but as soon as adb tries to install the allegro-example-debug.apk(which exists), I get that error.
PS: I'm on ubuntu 11.10

EDIT:
Here's the modified run.sh:

#SelectExpand
1#!/bin/bash 2 3#rsync --progress -r -t ~/allegro-5.1/android-project/ ~/android-project/ 4 5cp ~/android-toolchain/user/armeabi-v7a/lib/liballegro-debug.so jni/armeabi-v7a/ 6cp ~/android-toolchain/user/armeabi-v7a/lib/liballegro_primitives-debug.so jni/armeabi-v7a/ 7 8export ANDROID_NDK_TOOLCHAIN_ROOT=~/android-toolchain 9V=1 ~/Android/android-ndk-r7/ndk-build clean 10V=1 ~/Android/android-ndk-r7/ndk-build 11 12ant clean 13ant debug 14 15echo uninstall 16adb -d uninstall com.comuf.jgames 17echo install 18adb -d install bin/allegro-example-debug.apk 19echo start 20adb -d shell 'am start -a android.intent.action.MAIN -n com.comuf.jgames/.AllegroActivity'

I had to comment out the rsync line because it overwrote my files, and thus tried to compile for android-15, which I don't have installed.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

Ack, sorry about the rsync line, I forgot to comment/remove that one again.

The interesting thing, is I've been compiling for android-15, and it runs fine on my phone. All that states is what SDK you're using, not what device your phone is limited to.

I seem to have missed the error you're talking about, can you repost it?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

J-Gamer
Member #12,491
January 2011
avatar

oops... here it is:

install
1497 KB/s (350031 bytes in 0.228s)
  pkg: /data/local/tmp/allegro-example-debug.apk
Failure [INSTALL_FAILED_INVALID_APK]

EDIT:
Could it be necessary to use a rooted phone? I haven't rooted mine yet.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

J-Gamer said:

Could it be necessary to use a rooted phone? I haven't rooted mine yet.

Nope. I've not yet rooted mine either.

What device do you have? It seems that error may have to do with the architecture or some other incompatibility.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

I got the same error, and here's how I fixed it. My device only runs Android 1.6, which is SDK 4. I don't know about Ubuntu, but on Windows there is a 'package manager' for the Android SDK. I had to specifically install the Android 4 SDK. Then when I built everything, I made sure to change all 'armeabi-v7a' to 'armeabi' and also wherever a platform is required (including one of the .properties files, don't remember which) I used android-4. The code built before doing that wasn't compatible with my device.

Probably not necessary for you, but I also #ifdefed all GLES2 code in Allegro (ogl_draw.c, ogl_display.c, prim_opengl.c) and didn't build the shader addon.

Thomas Fjellstrom
Member #476
June 2000
avatar

If your device is Arm6, the only thing you should need to do is change armeabi-v7a to armeabi. AFAIK. It's perfectly all right to build an android app using a newer SDK that runs on an older device (I have 2.3.4, yet build using android-15 which is 4.0.1).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

J-Gamer
Member #12,491
January 2011
avatar

I'm on a Samsung Galaxy 551.

EDIT:
After some google-fu, I managed to find out my phone is armv6. I'll try your suggestion ^^. (But I'm still wondering why it was giving that error... it didn't do that yesterday)

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

Yeah, that's and ARM6 device. You need to bump everything down to armeabi rather than armeabi-v7a.

The cool thing is you can make both versions, and include the binaries in different jni/ sub folders, one for each arch, and android will know what to do.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

J-Gamer
Member #12,491
January 2011
avatar

Why do I have all the allegro libs double, even after ant clean?
They're jni/armeabi AND in libs/armeabi

EDIT:
So I managed to install it, but I'm still getting the same errors. I modified the run.sh script to use the armeabi folder, but couldn't find any other files referring to armeabi-v7a ._.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

Look in the allegro build stuff, you need to rebuild allegro as well.

J-Gamer said:

They're jni/armeabi AND in libs/armeabi

ndk-build looks for user libs in jni/* and it installs them to libs/ in the apk. I just think ndk-build clean doesn't bother to clean up libs/.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

J-Gamer
Member #12,491
January 2011
avatar

Why is it installing in armeabi-v7a while I used this command for cmake???
cmake .. -DANDROID_NDK_TOOLCHAIN_ROOT=$HOME/android-toolchain -DWANT_ANDROID=on -DCMAKE_INSTALL_PREFIX=$HOME/android-toolchain/user/armeabi/ -DWANT_EXAMPLES=OFF -DWANT_DEMO=OFF

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Thomas Fjellstrom
Member #476
June 2000
avatar

Ok, you also need to pass: -DARM_TARGETS=armeabi to cmake. Default is to compile with armeabi-v7a and install to armeabi-v7a, it seems the cmake code I stole and modified override CMAKE_INSTALL_PREFIX. I should probably fix that.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

I definitely did have to build with the 4 sdk. I built the exact code with 15 and it didn't work. Also, forgot this but I had to NOT link libandroid.so, which isn't available.

Thomas Fjellstrom
Member #476
June 2000
avatar

I'll check to see what my settings are, but they are probably what are in svn at the moment. But I know the standalone toolchain is android-15 or w/e.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Mark Oates
Member #1,146
March 2001
avatar

This thread's gettin' me all randy.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Thomas Fjellstrom
Member #476
June 2000
avatar

This thread's gettin' me all randy.

Heh. Well so far its working pretty well. I started on the filesystem access stuff. might support accessing those funky packed data files android has.

And I just had a thought, If there are any devices people want to make sure work, especially older ones, ones that run Android 1.6, or 2.0, or 2.1. I want to borrow such devices to make sure they all work, and so I can write up some decent documentation on how to get started working with Allegro on Android that works with all variants. My neighbour does have a 1.6 device, but I don't currently have the money to buy it off him (uber broke). Which is why I'm hoping people would be willing to temporarily lend older devices.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

MiquelFire
Member #3,110
January 2003
avatar

Well, if it didn't burn itself up, I would have a 2.1 device you could test with in April.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo



Go to: