Howto: Urho3d Android setup on win7+


#1

This is how I installed android dev env.
I’m no expert, I’m sure there’s better ways or I did something wrong, please comment if so.

I’ve given up winXP as I couldn’t fix the symbolic link issue on Android.

I Install (use the latest version) in this, order look at my Console android-batch file for locations I use (with no spaces):
7Zip
Notepade++
Java JDK (I copy the jdk-folder to C:\JDK)
TDM-GCC (required for lua tool building)
cmake
ant
gradle (not sure it’s required)
Urho3D (C:\Urho3D-master)

Lastly, install the Android SDK.exe setup to C:\Android\ (not the studio install exe)
Then extract the Android NDK to C:\Android\android-ndk
So you should have:
C:\Android\android-ndk
C:\Android\android-sdk

Create the console android-batch file in C:\Urho3D-master:

set path=%path%;C:\Android\android-ndk\prebuilt\windows\bin;C:\ant\bin;C:\gradle\bin;C:\Android\android-ndk\build;C:\Android\android-sdk\tools;C:\Android\android-sdk\tools\bin;C:\Android\android-sdk\platform-tools
set  ANDROID_NDK=C:\Android\android-ndk
set  ANDROID_SDK=C:\Android\android-sdk
set JAVA_HOME=C:\JDK
set GRADLE_HOME=C:\gradle
cmd /k cd

launch the android-batch file, and test:
cmake
make
ant
nkd-build
gcc
java
javac
android
gradle

They should all work! if not check the batch file paths/vars.

Next setup the SDK, run android
Click the Deselect all link.
From Tools -> tick the android SDK build tools, make sure platform-tool and SDK tools should be installed, if not also tick them.
Install Android 4.0.3 API 15 - This is the latest version which has an x86 image and is compatible with windows.
Tick SDK plaform, Intel x86 atom system image and google APIs.
I’m not familiar with all the packages here.
Click the install button and agree to everything.
It should download and install correctly.

Run:
android list target
You should get a list of targeted SDK, I use 1 Android-15

In the root Urho3D folder run:
cmake_android build -DURHO3D_SAMPLES=1
Adding other options required.

There should be no errors and the build folder should be created, cd into that folder and run:
android update project -p . -t 1
Where 1 is your targeted SDK ID
It should out put a few lines, with no error message.

Next run:
make
Optionally, add -j2 where 2 is the number of CPU cores you want to use to build.
It will compile the and link with ndk toolchain.
There should be no errors.
If so, the env isn’t setup correctly, ie Android SDK, native gcc or paths issues

To build an apk, run:
ant debug
Javac is used to create the Urho3D-debug.apk in the bin folder ie C:\Urho3D-master\build\bin
Copy it to your mobile and install it, it should work.

rebuild.bat:

call cmake_android build -DURHO3D_SAMPLES=1 cd build call android update project -p . -t 1 call make call ant debug

Debugging on Hardware:
Set your device up with USB debugging and stay awake on, under Dev options in Android settings .
On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.

Also, In screen setting, Turn sleep mode to never.

Make sure you have the USB driver installed

To kill the server forcefully:
adb kill-server

To start the server:
adb start-server

plug in device

run: adb devices
It should list your device

adb install C:\Urho3D-master\build\bin\Urho3D-debug.apk

developer.android.com/tools/help/adb.html
developer.android.com/tools/help/logcat.html

References:
urho3d.github.io/documentation/1 … lding.html
topic1142.html
Thanks to weitjong for his help.


Android CMake Error, could'nt find compiler toolchain
#3
d:\Android\Urho3D_Current\Build>android update project
**************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools\bin\sdkmanager.bat
and tools\bin\avdmanager.bat
**************************************************************************

Invalid or unsupported command "update project"

Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk

#4

You need to downgrade the Android build tool version (version 24 is my memory serves me right), if you insist on using the old approach.


#5

I got the Android build running when donwgraded the Android tools to these specific versions:

build-tools_r24.0.2

platform-tools_r25

tools_r25.2.3

I’ve found the versions numbers somewhere on the web.
Just downloaded and replaced the current tool versions with these ones and run everything else as specified in the Urho3D build documentation. Hope this helps!


#6

Hi sorry for bothering, but what is the new approach of building Urho3D on Android? You said this the old one.


#7

We have migrated to Gradle for Android build. Read the online doc for building the Urho3D lib. Make sure you use the HEAD version in the doc version switcher. Currently only tested to work on Win7, Linux and macOS host systems. YMMV on Windows 10.