Irrlicht on Android.....How do I install this thing?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

Hello,

I tracked down what I believe to be all of the files needed to compile for android and cannot get this to work. On instruction 3, below, I keep getting a message that "The system cannot find the path specified." I am trying to compile this on a Windows XP 64 system. My ANDROID_HOME environment variable is set to "d:\android\ADT-BU~1\sdk". Both the android SDK and android NDK paths have been added to the path. To the best of my knowledge, everything necessary is installed. As per the instructions below.

I've tried disabling the @echo command, from the ndk-build.cmd file (listed below) and find that it makes it as far as the call statement. If I execute the call statement directly, there is no error. Has anyone seen this or have any advice?




To use Android you need to have installed:
- Android SDK (from http://developer.android.com)
- Android NDK (from http://developer.android.com)
- ant (a build tool commonly used for Java)
- A Java jdk (for example openjdk-6-jdk)
- GNU Make 3.81 or later
- A recent version of awk
- On Windows you need to have Cygwin (at least version 1.7) installed


1. Assign your Android SDK path to ANDROID_HOME environment variable.
2. Add Android SDK (ANDROID_HOME) and Android NDK to your PATH environment variable.
3. Go to: source->Irrlicht->Android and call "ndk-build" or "ndk-build NDEBUG=1"
4. Go to: examples->17.HelloWorld_Mobile and call "ndk-build" or "ndk-build NDEBUG=1"
5. Call "ant debug" to create package
6. Connect device to PC (with USB debugging mode ON) or turn on emulator.
7. Call "adb -d install bin/HelloWorldMobile-debug.apk" (if you use emulator please add "-e" parameter instead of "-d") to install package on your device/emulator.
8. That's all! Now you can run example.



ndk-build.cmd

rem @echo off
rem This is a Windows cmd.exe script used to invoke the NDK-specific GNU Make executable
call "%~dp0find-win-host.cmd" NDK_WIN_HOST
if ERRORLEVEL 1 (exit /b 1)
set NDK_ROOT=%~dp0
"%NDK_ROOT%prebuilt/%NDK_WIN_HOST%/bin/make.exe" -f "%NDK_ROOT%build/core/build-local.mk" SHELL=cmd %*
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht on Android.....How do I install this thing?

Post by CuteAlien »

OK, I have no cygwin experience with Android so far - so will have to guess a little. One issue I read about on the web was that people had problems with project-path's having whitespaces in the name. Maybe check that.

Is that error you posted the only one - and is this the complete error and only message you are getting without anything cut out?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

Hello,

That is another problem. I don't have any cygwin experience, either. I'd try this on a Linux install; but, that would mean blowing away a Windows XP 64 install that took days to track down all the drivers for and install all the patches on.

I didn't see any place for there to be white-spaces in the path.

The error message is complete.

I tried searching for the error message and found some possible resolutions; but, nothing worked. One possibility was due to a bug in the 64 bit installation of ndk. So, I installed the 32 bit installation and the error didn't change.


Here is the entire execution. Note that the @echo off statement is commented out in order to trace the execution.

D:\irrlicht\irrlicht-ogl-es\source\Irrlicht\Android>ndk-build

D:\irrlicht\irrlicht-ogl-es\source\Irrlicht\Android>rem @echo off

D:\irrlicht\irrlicht-ogl-es\source\Irrlicht\Android>rem This is a Windows cmd.ex
e script used to invoke the NDK-specific GNU Make executable

D:\irrlicht\irrlicht-ogl-es\source\Irrlicht\Android>call "d:\android\android-ndk
-r9d\find-win-host.cmd" NDK_WIN_HOST
The system cannot find the path specified.

D:\irrlicht\irrlicht-ogl-es\source\Irrlicht\Android>


NDK_WIN_HOST is "windows" as per below:

D:\android\android-ndk-r9d>set NDK_WIN_HOST
NDK_WIN_HOST=windows



The path of d:\android\android-ndk-r9d\find-win-host.cmd does exist:

Directory of D:\android\android-ndk-r9d

03/11/2014 05:37 PM <DIR> .
03/11/2014 05:37 PM <DIR> ..
03/10/2014 11:06 AM 1,021 find-win-host.cmd
03/11/2014 05:38 PM 302 ndk-build.cmd
08/30/2013 10:07 PM 137,216 ndk-depends.exe
02/14/2014 01:38 PM 25,471 ndk-gdb
03/11/2014 04:46 PM <DIR> platforms
03/11/2014 04:25 PM <DIR> samples
03/11/2014 04:50 PM <DIR> sources
4 File(s) 164,010 bytes
5 Dir(s) 369,621,032,960 bytes free

D:\android\android-ndk-r9d>



Thanks!

Brian
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

A thought: Is it possible that irrlicht on android needs to be compiled from within the cygwin terminal?

Regards,

Brian
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht on Android.....How do I install this thing?

Post by CuteAlien »

Right, the REM commands should have given me the hint. So yes - I'm pretty sure it has to run inside cygwin.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

Ok. I moved the android sdk and ndk directories so they were inside cygwin, changed the paths as appropriate, ensured that the ndk-build.cmd file had executable attributes (attribs indicated x for everyone), attempted to execute the script from within cygwin, and it still didn't work.

I received the following:

$ ndk-build.cmd
'This' is not recognized as an internal or external command,
operable program or batch file.
The filename, directory name, or volume label syntax is incorrect.


The printenv command displays the correct paths in the environment.

I am starting to wonder if this concept was only tested within Linux.

Regards,

Brian
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Irrlicht on Android.....How do I install this thing?

Post by CuteAlien »

Admittably I haven't tested it on cygwin yet myself. But ndk-build is a script from google and they say it runs on cygwin. I'm surprised it's called ndk-build.cmd as it's usually just called ndk-build.

I can't help much more right now as I haven't set-up an Android environment on Windows yet. Will do within the next weeks, but no time for it right now unfortunately. So I hope someone else maybe can help...
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

Thanks for trying to help. Worst case, I'll have to build a dev environment on a Linux box. While that isn't necessarily a bad thing, it will mean a lot more work to setup.

Regards,

Brian



[quote="CuteAlien"]Admittably I haven't tested it on cygwin yet myself. But ndk-build is a script from google and they say it runs on cygwin. I'm surprised it's called ndk-build.cmd as it's usually just called ndk-build.

I can't help much more right now as I haven't set-up an Android environment on Windows yet. Will do within the next weeks, but no time for it right now unfortunately. So I hope someone else maybe can help...[/quote]
Agent_X
Posts: 41
Joined: Sun Sep 16, 2012 3:44 am

Re: Irrlicht on Android.....How do I install this thing?

Post by Agent_X »

reifsnyderb, hold up! I'm glad I looked at the forums today. I compile on Windows 7 x64 using the regular cmd.exe (no Cygwin!) I was using Cygwin but I read somewhere that the last few versions of the NDK doesn't require Cygwin. Anyway, your problem is most likely a path and/or environment variable problem. I'm sure you've messed with this until you're blue in the face (just as I did!) but I know I can help you with this. Give me a few minutes to look over your posts and my own settings/paths. Stand by...
mikkis
Posts: 64
Joined: Mon Jan 28, 2013 2:38 pm
Location: Fi

Re: Irrlicht on Android.....How do I install this thing?

Post by mikkis »

I have compiled Irrlicht fine without cygwin (w7, using latest android ndk+sdk).

Only that example's jni/Android.mk have lines like
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/irrlichtlogo3.png $(IRRLICHT_PROJECT_PATH)/assets/media/)

so these failed because command(dos) prompt doenst understand cp (copy). Just copy your datas manually.
Agent_X
Posts: 41
Joined: Sun Sep 16, 2012 3:44 am

Re: Irrlicht on Android.....How do I install this thing?

Post by Agent_X »

Ok reifsnyderb. I'm going to not assume anything. I'm including all my settings so please don't take offense if there is some redundancy or obvious stuff in here. I've learned that oftentimes it's the stuff a well-meaning person leaves out that ultimately was the fix to my own errors! So here goes...


OS: Windows 7 64-bit
Android SDK: Must be 32-bit version because the default install path was "C:\Program Files (x86)\Android\android-sdk"
Android NDK: Definitely the 32-bit version because I used the "android-ndk-r9b-windows-x86.zip" file
JDK: Definitely the 32-bit version of this also (I used the "jdk-7u51-windows-i586.exe" file)


Environmet Variables -> System variables
-------------------------------------------------

Variable name: JAVA_HOME
Variable value: C:\Progra~2\Java\jdk1.7.0_51\

Variable name: ANDROID_HOME
Variable value: C:\Progra~2\Android\android-sdk\

Variable name: Path
Variable value: %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin;C:\Progra~2\Android\android-sdk;C:\Progra~2\Android\android-ndk-r9c;C:\apache-ant-1.9.2\bin;
(Only the relevant values shown above)


Irrlicht
--------

I used SVN and grabbed the "irrlicht-code-4688-branches-ogl-es.zip" file from https://svn.code.sf.net/p/irrlicht/code ... es/ogl-es/


Building Irrlicht
------------------

- I opened cmd.exe

- I navigated my way to \irrlicht-code-4688-branches-ogl-es\source\Irrlicht\Android

- I typed (without the quotes) "ndk-build"

- Everything worked except at the end when the process tried to copy the "libIrrlicht.a" file to the lib directory. The error message was:

cp obj/local/armeabi/libIrrlicht.a jni/../../../../lib/Android
process_begin: CreateProcess(NULL, cp obj/local/armeabi/libIrrlicht.a jni/../../../../lib/Android, ...) failed.
make (e=2): The system cannot find the file specified.
make.exe: *** [jni/../../../../lib/Android] Error 2

- So I manually copied the "libIrrlicht.a" file from \irrlicht-code-4688-branches-ogl-es\source\Irrlicht\Android\obj\local\armeabi to \irrlicht-code-4688-branches-ogl-es\lib\Android


Building 27.HelloWorld_Android
-------------------------------------

- I opened cmd.exe

- I navigated my way to \irrlicht-code-4688-branches-ogl-es\examples\27.HelloWorld_Android

- I typed (without the quotes) "ndk-build"

- Similar to before, the process fails to copy the required models and images to the assets folder

- So I manually copied the following from \irrlicht-code-4688-branches-ogl-es\media to \irrlicht-code-4688-branches-ogl-es\examples\27.HelloWorld_Android\assets\media

irrlichtlogo3.png
sydney.md2
sydney.bmp
fonthaettenschweiler.bmp
bigfont.png
the entire "Shaders" folder

- I removed the following lines from the "\irrlicht-code-4688-branches-ogl-es\examples\27.HelloWorld_Android\jni\Android.mk" file (they are at the end):

# copy Irrlicht data to assets

$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/assets)
$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/assets/media)
$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/assets/media/Shaders)
$(shell mkdir -p $(IRRLICHT_PROJECT_PATH)/src)
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/Shaders/*.* $(IRRLICHT_PROJECT_PATH)/assets/media/Shaders/)
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/irrlichtlogo3.png $(IRRLICHT_PROJECT_PATH)/assets/media/)
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/sydney.md2 $(IRRLICHT_PROJECT_PATH)/assets/media/)
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/sydney.bmp $(IRRLICHT_PROJECT_PATH)/assets/media/)
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/fonthaettenschweiler.bmp $(IRRLICHT_PROJECT_PATH)/assets/media/)
$(shell cp $(IRRLICHT_PROJECT_PATH)/../../media/bigfont.png $(IRRLICHT_PROJECT_PATH)/assets/media/)

- I typed (without the quotes) "ndk-build"

- Then I typed (without the quotes) "ant debug"

- And finally I typed (without the quotes) "adb install bin\HelloWorldMobile-debug.apk

- It works perfectly on my Google Nexus 7 tablet (2012 version), but I get just a gray screen on my old Huawei-U8665 phone


I tried the same on my 32-bit Ubuntu 13.04 environment and it works perfectly. No errors copying the lib file or the assets. I'm assuming the syntax of those commands in the "Android.mk" file are not Windows-friendly and would require a rewrite. I solved this problem in my own projects by just manually putting my projects assets in the assets folder. Also I did have issues in the beginning if any of the folders or files had whitespaces in the names. Using dashes and/or underscores fixed this of course.

I hope this helps.
Agent_X
Posts: 41
Joined: Sun Sep 16, 2012 3:44 am

Re: Irrlicht on Android.....How do I install this thing?

Post by Agent_X »

I was typing away when mikkis replied! Sorry for any duplicate info.

@mikkis: Your reply was of the Short & Sweet & Get-Right-To-The-Point variety lol. It probably solves reifsnyderb's issue :D
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

AgentX and mikkis:

Thanks! I am going to try your advice and see what happens. First, I'll rip out all the 64 bit stuff and install the 32 bit software, as advised.

I'll report back as to what happened.

I probably should have checked back before ordering another hard disk so as to do a Linux install without messing with my Windows XP 64 install. Oh, well.

Best Regards,

Brian
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

Update:

Trying to install the 32-bit sdk. When extracting the .zip file, I keep getting an "Error Copying file or folder" with a message "The system cannot cannot find the file specified". Gotta love Micro$oft for giving such great error messages that isolate the problem so precisely. :x

I'll give it a little more effort. If it keeps fighting, I'll just install Linux once my hard disk arrives.

Regards,

Brian
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Re: Irrlicht on Android.....How do I install this thing?

Post by reifsnyderb »

Found an sdk installer and trying that....
Post Reply