Hahaha. That's a huge task. Luckily I wrote everything on a side note as I found how to do everything. Here's the tutorial. Maybe it can be optimized, but it should work.
JAVA
Install latest Java:
https://www.java.com/fr/download/
Install latest Java JDK:
https://www.oracle.com/technetwork/java ... index.html
Set environment variable JAVA_HOME C:\Program Files\Java\jdk1.8.0_191
ANDROID
Install Android NDK :
https://developer.android.com/ndk/downloads/
Unzip it inside c:\Android
Install Android SDK and Apache Ant:
Unfortunately, Android SDK is now included inside the HUGE Android Developer Studio. So the easiest way to get SDK and Ant is to install LazToApk:
https://sourceforge.net/projects/laztoapk/
And then retrieve those directories:
C:\laztoapk\downloads\android-sdk-windows
C:\laztoapk\downloads\apache-ant-1.10.3
Just copy/paste them inside C:\Android
Now you should have:
C:\Android\android-ndk-r18b
C:\Android\android-sdk-windows
C:\Android\apache-ant-1.10.3
And you can uninstall LazToApk.
Update Android SDK:
Launch C:\Android\android-sdk-windows\SDK Manager.exe
Here's what you need:
Tools \ Android SDK Tools
Tools \ Android SDK Platform-tools
Tools \ Android SDK Build-tools
Android 8.0.0 (API 26) \ SDK Platform
Android 4.1.2 (API 16) \ SDK Platform
FREE PASCAL
Install Free Pascal official release:
https://sourceforge.net/projects/freepa ... in32/3.0.4
fpc-3.0.4.i386-win32.exe
It should be installed to C:\FPC\3.0.4
Download Free Pascal Daily Source Snapshot of Development Tree (trunk):
https://www.freepascal.org/develop.var
Extract it to C:\FPC
Create the directory C:\FPC\trunk
Build Free Pascal trunk:
Inside C:\FPC\fpc, create make_i386.bat with:
Code: Select all
PATH=C:\FPC\3.0.4\bin\i386-win32;
SET FPC=C:\FPC\3.0.4\bin\i386-win32\fpc.exe
make.exe clean distclean
make.exe all OPT="-gw -godwarfset -O-1"
make.exe install INSTALL_PREFIX=c:\FPC\trunk COPYTREE=echo
Launch make_i386.bat and make some coffee.
Build Free Pascal cross Android Trunk:
Inside C:\FPC\fpc, create make_android.bat with:
Code: Select all
PATH=C:\FPC\3.0.4\bin\i386-win32;C:\Android\android-ndk-r18b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin;
SET FPC=C:\FPC\3.0.4\bin\i386-win32\fpc.exe
make clean crossall crossinstall OS_TARGET=android CPU_TARGET=arm CROSSOPT="-dANDROID -CpARMv6 -CfVFPv2" INSTALL_PREFIX=C:\FPC\trunk
Launch make_android.bat and go outside for some fresh air.
Add C:\Android\android-ndk-r18b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin
to your System environment variable Path
ZGAMEEDITOR
Download ZGameEditor source code:
https://github.com/VilleKrumlinde/zgameeditor
Here's my modified C:\zgameeditor-master\Build\android\m.bat with the correct folders:
Code: Select all
pushd "%~dp0"
if not exist "java\libs\armeabi\" mkdir java\libs\armeabi
if not exist "lib\arm-linux\" mkdir lib\arm-linux
C:\FPC\trunk\bin\i386-win32\ppcrossarm -B -MDelphi -Sghi -O3 -Tandroid -Parm -XXis -vw -Filib\arm-linux -FlC:\Android\android-ndk-r18b\platforms\android-26\arch-arm\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\armeabi\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -CpARMV6 -CfVFPv2 zgeandroid.pas
IF %ERRORLEVEL% NEQ 0 GOTO error
cd java
call m.bat
cd ..
:error
popd
pause
And finally here's my modified AndroidManifest.xml:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="$package$"
android:versionCode="$versionnumber$"
android:versionName="$versionname$" >
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.gamepad" />
<application
android:icon="@drawable/icon"
android:label="$title$" >
<meta-data android:name="isGame" android:value="true" />
<activity
android:label="$title$"
android:name="org.zgameeditor.ZgeActivity"
android:configChanges="screenLayout|orientation|keyboardHidden|fontScale"
android:screenOrientation="sensorLandscape" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And the default.properties file:
Code: Select all
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-26