eC - Installation
Fork me on GitHub

Targeting Android

You can build the Ecere runtime for Android

Source Code

http://github.com/ecere/ecere-sdk/

Clone with Git

git clone https://github.com/ecere/ecere-sdk.git

Tarballs

Latest Release (0.44.15 August 4, 2016
Latest Development Snapshot

Installation per Platform

Target Platforms

Source Code




To build the Ecere runtime for Android, you will first need to setup:

You will then be able to create an Android configuration for your Ecere apps (select shared library target) and link with libecere.

Refer to the detailed instructions below.

Building for Android


Here is a rough draft for instructions to build and run Ecere on Android.

Android support is still being worked on, and we hope to make this a lot easier/integrated in the future.

So, be warned, there are a lots of steps involved.

First you need to install the Android SDK (You won't be needing Eclipse, so click on Download for Other Platforms and select SDK Tools Only) and NDK, as well as the Java JDK.

Then you set up the paths to all these in the File/Global Settings/Compilers.

You create a new compiler for Android.

You need to decide if you want to make an ARM compiler (for the device) or an Intel compiler (for the Android emulator).

You could also create both.

The active compiler can be selected in the IDE (Through the second-to-rightmost drop box in the toolbar)

in Ecere IDE... File/Global Settings/compiler For my ARM compiler..

Executables files:

C:\Program Files\Ecere SDK\bin
C:\android-sdk\android-ndk-r9b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin
C:\android-sdk\tools
C:\android-sdk\platform-tools
C:\android-sdk\android-ndk-r9d
C:\Program Files (x86)\Java\jdk1.7.0_03\bin


Library Files:

C:\android-sdk\android-ndk-r9b\platforms\android-14\arch-arm\usr\lib
E:\ecere-sdk\ecere\obj\android.linux.androidARM-4.6


SYSROOT: C:/android-sdk/android-ndk-r9d/platforms/android-19/arch-arm

GNU Toolchain Prefix: arm-linux-androideabi-

If you use a 64 bit toolchain, make sure to include -t32 in 'Additional eC Compiler Flags' under Option, otherwise things will not be built properly. Alternatively, you can install the 32 bit Ecere binaries (Which can be built with ARCH=x32) and ensure that they have priority in the path.

And you'll need to prepare a key for jarsigner to sign the APK:

keytool -genkey -v -alias mykey -keyalg RSA -keysize 2048 -validity 10000


Or for generating the Debug key

keytool -genkey -v -keyalg RSA -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US" -validity 999999


Also, you will need to build the Ecere library with the Android config You can add the ecere.epj project (from the Ecere SDK source directory, see links above for source code) to your project's workspace, and build it from there (select 'Android' configuration)

You will also need to build some extra dependencies which are not already part of the NDK, to build the Android ecere library successfully:
  • FreeType (You can find the source for freetype-2.3.12 included in the sdk/deps/ directory)
  • libungif (sdk/deps/libungif-4.1.1)
  • libpng (sdk/deps/libpng-1.6.12)
  • libjpeg (sdk/deps/jpeg-9a)
You should be able to use the Ecere project files (.epj) in there already, just select your proper Android compiler and build for the Release config. The libecere project's Android config refers to the location in there, so it should automatically find them there.

Then you can try the sdk/samples/android, which has the extra manifest and string XML files, as well as all the commands to build the APK in the Project Settings/Builder/Post-build Commands. Make sure you use the compiler and directories for the appropriate architecture:

Create the target directory for the application:

$(call mkdir,$(OBJ)apk/lib/armeabi) $(call mkdir,$(OBJ)apk/lib/x86)


Copy the Ecere runtime for the right platform:

$(call cp,/sdk/ecere/obj/android.linux.$(COMPILER)/libecere.so,$(OBJ)apk/lib/x86)


Copy the application:

$(call cp,$(TARGET),$(OBJ)apk/lib/x86)


Create the APK:

aapt package -v -f -m -M android/AndroidManifest.xml -F $(OBJ)$(MODULE)-unsigned.apk -I C:/android-sdk/platforms/android-16/android.jar -S android/res $(OBJ)apk


Sign the APK:

jarsigner -storepass mypassword -sigalg MD5withRSA -digestalg SHA1 $(OBJ)$(MODULE)-unsigned.apk mykey -signedjar $(OBJ)$(MODULE).apk


These adb commands automatically (re)install and launch the application when you build:

adb uninstall com.ecere.Hello adb install $(OBJ)$(MODULE).apk adb shell am start -a android.intent.action.MAIN -n com.ecere.Hello/android.app.NativeActivity


Note that you must have started adb (adb start-server) yourself before building, or else the adb commands will freeze the IDE until you kill adb.

You can create an Android config in your own project and base it on this sample.

Note that the Android config of your application should have Shared Library as Target Type (in Project Settings/Linker).

Typical libraries for your config should be: ecere log android EGL GLESv1_CM