ZGameEditor & Android Setting

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZGameEditor & Android Setting

Post by VilleK »

Thanks for analysing the problem. I don't know why Android now has this requirement but I guess it is something security related. I hope there is a switch in the Freepascal for Android compiler or an update that will fix this. I'll investigate but since it is the middle of summer and I'm working less than usual I can't make any promise when it will be fixed.

edit: I see the Fpc issue link you posted. Ok then upgrading Fpc should fix this.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

I've just received that from Google. Everyone that made a ZGE apk should be concerned :
Hello Google Play Developer,

This is a reminder that starting November 1, 2018, updates to apps and games on Google Play will be required to target Android Oreo (API level 26) or higher. After this date, the Play Console will prevent you from submitting new APKs with a targetSdkVersion less than 26.

Configuring your app to target a recent API level ensures that users benefit from significant security and performance improvements, while still allowing your app to run on older Android versions (down to the minSdkVersion).

Action required

Please ensure that your apps are configured to target at least Android 8.0 (API level 26) by November 1, 2018. For technical advice on how to change your app's target API level to meet these requirements, refer to the migration guide.
Ville, can you produce a new ZGE exe with an up to date Fpc so I can run tests ? Thanks
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZGameEditor & Android Setting

Post by VilleK »

I still haven't found the time to upgrade Fpc. It is quite a difficult process to upgrade because you have to build the compiler from sources and before doing that you need correct version of Fpc (Fpc sources are built using Fpc) and Android NDK. I estimate it could take at least a day to get this working, and it is quite frustrating work that I'm not keen on doing, at least not in the middle of summer.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

Oh, ok :)
I didn't know it was that tedious. Have a good summer !
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

Hi Villek, November has arrived and Google Play won't support apk made with ZGE starting today...
I hope you'll find the time to upgrade the Fpc :cry:
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

So I'm browsing the ZGE sourcecode while preparing a linux computer with freePascal in order to compile the Player_linux.bin and see if I can do something about the Android API. For starters, can you add "sensorLandscape" to the choices of the Android export tool?

In zgameeditor-master\tools\ZDesigner\frmAndroidApk.dfm

Code: Select all

Items.Strings = (
  'Portrait'
  'Landscape'
  'sensorLandscape')
In zgameeditor-master\ZApplication.pas

Code: Select all

AndroidPortrait : byte;
and make it something like:
0 = Portrait
1 = Landscape
2 = sensorLandscape

and adapt the few "if then" lines that goes with it in ZDesigner\frmEditor.pas

(I can't compile the Editor on linux so I'm not going to push anything on git.)

There's a lot of other options for android:screenOrientation in the manifest, but maybe it's not worth adding them all

Code: Select all

android:screenOrientation=["unspecified" | "behind" |
                           "landscape" | "portrait" |
                           "reverseLandscape" | "reversePortrait" |
                           "sensorLandscape" | "sensorPortrait" |
                           "userLandscape" | "userPortrait" |
                           "sensor" | "fullSensor" | "nosensor" |
                           "user" | "fullUser" | "locked"]
Last edited by Ats on Thu Dec 06, 2018 5:13 pm, edited 1 time in total.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZGameEditor & Android Setting

Post by VilleK »

Good suggestion, I committed this now so it should be on github.
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: ZGameEditor & Android Setting

Post by Kjell »

Hi guys,

If there's going to be support for on-the-fly orientation changes ( Configuration Changed event ), perhaps it would be a good idea to set the screenOrientation for ZGEAndroid-debug.apk to sensor? Would make it a lot easier to debug portrait-mode projects.

K
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

Ok, I've prepared a laptop with Delphi Starter and Android NDK for my hollydays. What should I do or investigate in order to try building a working APK for android API 26+ ?
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZGameEditor & Android Setting

Post by VilleK »

You need to setup Freepascal to compile for Android target.

I think this is the main page for instructions on how to do that:

http://wiki.freepascal.org/Android#Down ... or_Android
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

Ok, I think I managed to set up everything in order to start playing around.
But I get some errors while compiling ZzDC for Android (is that the one I'm supposed to compile anyway?)

Code: Select all

[DCC Erreur] ZClasses.pas(85): E2003 Undeclared identifier: 'PAnsiChar'
[DCC Error] ZClasses.pas(280): E2154 Type 'TZComponent' needs finalization - not allowed in variant record
[DCC Error] ZClasses.pas(281): E2007 Constant or type identifier expected
[DCC Error] ZClasses.pas(283): E2154 Type 'TZComponentList' needs finalization - not allowed in variant record
[DCC Error] ZClasses.pas(288): E2154 Type 'TZExpressionPropValue' needs finalization - not allowed in variant record
[DCC Error] ZClasses.pas(521): E2005 'PAnsiChar' is not a type identifier
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZGameEditor & Android Setting

Post by VilleK »

Those errors seems odd. Can you show the version info about the Freepascal you are using to compile?

And make sure you are using the same build parameters that I used. See the file "Build/android/m.bat" in the ZGE repo.
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

I've downloaded fpc 3.0.4. How do you get the version info ?

There's no such file as ppccrossarm coming with Delphi starter. So I tried installing FreePascal cross android (fpc-3.0.4.i386-win32.cross.android.exe). But this one is stuck at the NDK folder detection. Even though it is installed and working well for years.

I tried:
C:\Android\NDK
C:\Android\NDK\platforms\android-28\arch-arm\usr\lib
and many other folders...

So I re-downloaded the NDK just in case, but still can't pass the NDK detection dialogue.

So I tried fpc-3.0.4.i386-win32.cross.arm-wince.exe which contains ppccrossarm but that leads me to another error:

Code: Select all

C:\zgameeditor-master\Build\android>C:\fpc\3.0.4\bin\i386-win32\ppcrossarm -B -MDelphi -Sghi -O3 -Tandroid -Parm -XXis -vw -Filib\arm-linux -FlC:\android\NDK\platforms\android-28\arch-arm\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\armeabi\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -CpARMV6 -CfVFPv2 zgeandroid.pas
Free Pascal Compiler version 3.0.4 [2017/10/06] for arm
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling zgeandroid.pas
Fatal: Can't find unit system used by zgeandroid
Fatal: Compilation aborted

Edit:

After a few readings, I tried laz4android1.8, but it gets stuck at launch.
So I tried laztoapk, which downloads everything once again (sdk, ndk, ant, laz4android...) and setup everything correctly so it can be launched.
But I get that error:

Code: Select all

C:\zgameeditor-master\Build\android>C:\laztoapk\downloads\laz4android1.8\fpc\3.0.4\bin\i386-win32\ppcrossarm -B -MDelphi -Sghi -O3 -Tandroid -Parm -XXis -vw -Filib\arm-linux -FlC:\laztoapk\downloads\android-ndk-r17c\platforms\android-28\arch-arm\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\armeabi\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -CpARMV6 -CfVFPv2 zgeandroid.pas
Free Pascal Compiler version 3.0.4 [2017/12/07] for arm
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling zgeandroid.pas
PPU Loading C:\laztoapk\downloads\laz4android1.8\\fpc\3.0.4\units\arm-android\rtl\system.ppu
Trying to use a unit which was compiled with a different FPU mode
PPU Loading C:\laztoapk\downloads\laz4android1.8\fpc\3.0.4\units\arm-android\rtl\system.ppu
Trying to use a unit which was compiled with a different FPU mode
Fatal: Can't find unit system used by zgeandroid
Fatal: Compilation aborted
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZGameEditor & Android Setting

Post by Ats »

Using -vut I managed to get some informations:

Code: Select all

C:\zgameeditor-master\Build\android>C:\fpc\3.0.4\bin\i386-win32\ppcrossarm -vut -B -MDelphi -Sghi -O3 -Tandroid -Parm -XXis -vw -Filib\arm-linux -FlC:\android\NDK\platforms\android-28\arch-arm\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\armeabi\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -CpARMV6 -CfVFPv2 zgeandroid.pas
Configfile search: fpc.cfg
Configfile search: C:\Users\Ats\fpc.cfg
Configfile search: C:\ProgramData\fpc.cfg
Configfile search: C:\fpc\3.0.4\bin\i386-win32\fpc.cfg
Reading options from file C:\fpc\3.0.4\bin\i386-win32\fpc.cfg
Path "C:\FPC\3.0.4\units\arm-android\" not found
Path "C:\FPC\3.0.4\units\arm-android\*\" not found
Path "C:\FPC\3.0.4\units\arm-android\rtl\" not found
Path "C:\FPC\3.0.4\units\arm-android\httpd22\" not found
Path "C:\Users\Ats\AppData\Local\\FreePascal\fppkg\units\arm-android\*\" not found
Path "C:\FPC\3.0.4\lib\arm-android\" not found
Path ".\lib\arm-linux\" not found
Free Pascal Compiler version 3.0.4 [2017/10/06] for arm
Copyright (c) 1993-2017 by Florian Klaempfl and others
Path "C:\fpc\3.0.4\units\arm-android\rtl\" not found
Compiler: C:\fpc\3.0.4\bin\i386-win32\ppcrossarm.exe
Target OS: Android for ARMEL
Using executable path: C:\fpc\3.0.4\bin\i386-win32\
Using unit path: .\
Using unit path: C:\zgameeditor-master\
Using unit path: C:\fpc\3.0.4\bin\i386-win32\
Using library path: C:\android\NDK\platforms\android-28\arch-arm\usr\lib\
Using library path: .\
Using library path: C:\zgameeditor-master\
Using library path: C:\fpc\3.0.4\bin\i386-win32\
Using object path: .\
Using object path: C:\zgameeditor-master\
Using object path: C:\fpc\3.0.4\bin\i386-win32\
Compiling zgeandroid.pas
Searching file zgeandroid.pas... found
(PROGRAM)  Registering new unit SYSTEM
(PROGRAM)  Load from ZGEANDROID (implementation) unit SYSTEM
(SYSTEM)   Loading unit SYSTEM
Unitsearch: system.ppu
Unitsearch: lib\arm-linux\system.ppu
Unitsearch: system.pp
Unitsearch: system.pas
Unitsearch: system.ppu
Unitsearch: system.pp
Unitsearch: system.pas
Unitsearch: C:\zgameeditor-master\system.ppu
Unitsearch: C:\zgameeditor-master\system.pp
Unitsearch: C:\zgameeditor-master\system.pas
Unitsearch: C:\fpc\3.0.4\bin\i386-win32\system.ppu
Unitsearch: C:\fpc\3.0.4\bin\i386-win32\system.pp
Unitsearch: C:\fpc\3.0.4\bin\i386-win32\system.pas
Unitsearch: system.pp
Unitsearch: system.pas
Unitsearch: system.pp
Unitsearch: system.pas
Unitsearch: C:\zgameeditor-master\system.pp
Unitsearch: C:\zgameeditor-master\system.pas
Unitsearch: C:\fpc\3.0.4\bin\i386-win32\system.pp
Unitsearch: C:\fpc\3.0.4\bin\i386-win32\system.pas
Fatal: Can't find unit system used by zgeandroid
Fatal: Compilation aborted

So I'm reading http://wiki.freepascal.org/Unit_not_fou ... find_units right now
Case 3.2: The compiler cannot find source (.pas, .pp) or .ppu file
In this case you have to extend the search path. The question is: add the .ppu directory or the source directory?
But I searched on my computer for system.pp/pas/ppu and I don't have that file at all.
Case 3.3: The wrong compiler is being used
Maybe that's the case since I'm using ppcrossarm from fpc-3.0.4.i386-win32.cross.arm-wince.exe and not from fpc-3.0.4.i386-win32.cross.android.exe ? I don't know...

Edit:
That must come from that, because I don't have the Path "C:\FPC\3.0.4\units\arm-android\". In fact, I only have i386-win32 and arm-wince in the units folder. So I'm back at trying to install fpc-3.0.4.i386-win32.cross.android.exe :roll:

Edit 2:
Right now I'm browsing the fpc-3.0.4.i386-win32.cross.android.exe installation source code: https://fossies.org/linux/fpcbuild/inst ... ndroid.ist

Code: Select all

138     NdkLib:=NdkPath + 'platforms\android-9\';
139     if not FileExists(NdkLib + 'arch-x86\usr\lib\crtbegin_so.o') then begin
140       MsgBox('Unable to find NDK library files.', mbError, MB_OK);
141       exit;
142     end;
But I only have android folders from 16 to 28 in the platforms folder.
So I managed to retrieve an android-9 folder which I just put there. It was in a SDK.zip that was just laying around in the C:\Android folder, with platform support from android 3 to 14. I absolutely don't know where that file comes from. Maybe some legacy stuff...

Now the install of fpc-3.0.4.i386-win32.cross.android.exe says "Unable to find NDK binutils for mipsel-linux-android"
Back at installation source code. It is searching for a mipsel-linux-android folder inside toolchains folder.
So I followed this in order to create a fake mipsel-linux-android folder: https://stackoverflow.com/questions/351 ... prefix-llv but it didn't work.
So back at NDK.zip to retrieve mipsel-linux-android-4.6 folder, move it to where it is needed, and rename it to mipsel-linux-android-4.9

And now I can finally install fpc-3.0.4.i386-win32.cross.android.exe and obtain my C:\FPC\3.0.4\units\arm-android\ folder, which contains arm-android\rtl\system.ppu

So back to m.bat !

And...

Code: Select all

C:\zgameeditor-master\Build\android>C:\fpc\3.0.4\bin\i386-win32\ppcrossarm -B -MDelphi -Sghi -O3 -Tandroid -Parm -XXis -vw -Filib\arm-linux -FlC:\android\NDK\platforms\android-9\arch-arm\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\armeabi\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -CpARMV6 -CfVFPv2 zgeandroid.pas
Free Pascal Compiler version 3.0.4 [2017/10/07] for arm
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling zgeandroid.pas
PPU Loading C:\FPC\3.0.4\units\arm-android\rtl\system.ppu
Trying to use a unit which was compiled with a different FPU mode
Fatal: Can't find unit system used by zgeandroid
Fatal: Compilation aborted
It's still a mess :x
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZGameEditor & Android Setting

Post by VilleK »

Nice work so far, and indeed it can drive you crazy getting stuff like this to work. So I hope now you understand why I've been reluctant to do so.

Since it complains about FP-mode, try removing the "-CfVFPv2" parameter.
Post Reply