[Lazarus] Android build without ant

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Mar 27 10:42:23 CEST 2012


Thanks, "call" seams to do the trick.

The next issues:

1> How to add more files to the apk. aapt tool seams to have no way
for me to specify where the file will be inside the package and here
it simply strips all of the paths, not even keeping the relative dir

F:\Programas\lazarussvn\examples\androidlcl\android>aapt a bin\androidlcltest.ap
_ libs\armeabi\liblclapp.so
 'libs\armeabi\liblclapp.so' as 'liblclapp.so'... <<--- I want it to
add as "lib\armeabi\liblclapp.so"

Maybe I will have to write a tool for this =/

2> Signing. Your method seams to require a "keystore" and even asks me
for a password? But plain "ant debug" does not require any password to
be typed and just works .... any ideas how it achieves that?

Enter Passphrase for keystore:
jarsigner error: java.lang.RuntimeException: keystore load: C:\Documents and Set
tings\Opera\.keystore (Nie mo┐na odnalečŠ okreťlonego pliku)
Aby kontynuować, naciśnij dowolny klawisz . . .

Current file:

REM Adjust these paths to yours
SET PATH=C:\Programas\android-sdk\tools;C:\Programas\android-sdk\platform-tools\;C:\Progra~1\Java\jdk1.6.0_20\bin
SET APP_NAME=androidlcltest
SET ANDROID_HOME=C:\Programas\android-sdk
SET APK_SDK_PLATFORM=C:\Programas\android-sdk\platforms\android-8
SET APK_PROJECT_PATH=F:\Programas\lazarussvn\examples\androidlcl\android

mkdir bin
mkdir bin\classes
mkdir gen
mkdir gen\com
mkdir gen\com\pascal
mkdir gen\com\pascal\lcltest

REM Cleanup
del bin\%APP_NAME%.ap_

REM Resource compilation
call aapt p -f -M AndroidManifest.xml -F bin\%APP_NAME%.ap_ -I
%APK_SDK_PLATFORM%\android.jar -S res -m -J gen
aapt a bin\%APP_NAME%.ap_ libs\armeabi\liblclapp.so

REM Java compiler
call javac -classpath %APK_SDK_PLATFORM%\android.jar -d bin\classes

REM DX to convert the java bytecode to dalvik bytecode
call dx --dex --output=%APK_PROJECT_PATH%\bin\classes.dex

REM It seams that dx calls echo off
@echo on
REM Now build the unsigned APK
call apkbuilder %APK_PROJECT_PATH%\bin\%APP_NAME%-unsigned.apk -u -z

REM Signing the APK with a debug key
REM KEYSTORE = /home/sven/android.keystore -keystore $(KEYSTORE)
jarsigner -signedjar bin\%APP_NAME%.apk bin\%APP_NAME%-unsigned.apk debugkey

REM call and pause together allow us to see the results in the end

Felipe Monteiro de Carvalho

More information about the Lazarus mailing list