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..
C:\Program Files\Ecere SDK\bin
C:\Program Files (x86)\Java\jdk1.7.0_03\bin
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:
Copy the Ecere runtime for the right platform:
Copy the application:
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