A.M. Hoornweg 144 Posted June 29, 2020 Hello all, I'm totally new to Android, and so far I'm having zero success getting Embarcadero's sample programs to run on Android. I am running Delphi 10.4 inside a VMWare VM. On my host machine, I have the Bluestacks 4.215.0.1019 emulator running, with ADB debugging enabled. Connection details: I am aware that Bluestacks only binds to localhost (127.0.0.1) so I have setup a port forwarding on the host (netsh interface portproxy add v4tov4 listenport=5556 connectaddress=127.0.0.1 connectport=5555) so that I can connect to the emulator from external IP addresses through TCP port 5556. I have enabled both ports 5555 and 5556 in the firewall. I have tested this setup and I can successfully connect to the emulator from my Delphi VM ("adb connect ip-address:5556") and send adb commands to it. I had expected this connectivity to be the biggest hurdle but it worked immediately. I have cloned Embarcadero's official sample repository from github (https://github.com/Embarcadero/RADStudio10.4Demos.git) and now I'm trying to compile and run the application in "Samples\Object Pascal\Multi-Device Samples\User Interface\Forms". I've activated the Android 32-bit target (guessing that Bluestacks emulates a 32 bit device) and the Delphi IDE "sees" the device without problems (see screenshot), it's called "SM-G973F". Since this is an "official" demo application, I was hoping things would work out of the box so I could use it as a starting point! But when I press F9, Delphi does a lengthy compiling act, and then throws the following errors: [PAClient Error] Error: E2312 Unable to execute '"C:\Users\Public\Documents\Embarcadero\Studio\21.0\PlatformSDKs\android-sdk-windows\build-tools\28.0.2\Aapt.exe" package -f -M "C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\AndroidManifest.xml" -F "C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\bin\Forms-unsigned.apk" -I "C:\Users\Public\Documents\Embarcadero\Studio\21.0\PlatformSDKs\android-sdk-windows\platforms\android-26\android.jar" -S "C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\res" -A "C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\assets" "C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\library" "C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\classes"' (Error 1) [PAClient Error] Error: E2312 C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\Multi-Device Samples\User Interface\Forms\Android\Debug\Forms\AndroidManifest.xml:21: error: No resource identifier found for attribute 'requestLegacyExternalStorage' in package 'android' The error messages aren't helpful at all, what the heck is "Error 1" supposed to mean? Can anyone point me to a solution? Thanks in advance, Arthur Share this post Link to post
Dave Nottage 557 Posted June 29, 2020 The problem you're seeing is usually due to an outdated AndroidManifest.template.xml file. Deleting the file (a new one will be recreated) should resolve the issue Share this post Link to post
A.M. Hoornweg 144 Posted June 29, 2020 2 hours ago, Dave Nottage said: The problem you're seeing is usually due to an outdated AndroidManifest.template.xml file. Deleting the file (a new one will be recreated) should resolve the issue Deleting the xml file makes no difference. It gets re-created, yes, and then I get the exact same error messages as before. And then Delphi hangs completely, I have to shoot it down in the task manager. All in all, deploying to Android seems unfunctional. Share this post Link to post
Dave Nottage 557 Posted June 30, 2020 16 hours ago, A.M. Hoornweg said: Deleting the xml file makes no difference Sorry, I had it confused with another issue. I just had exactly the same issue as you (on a machine I don't use often), and solved it by changing the SDK settings to use build-tools\29.0.3 (instead of 28.0.3) for ZipAlign.exe and AAPT.exe Share this post Link to post
A.M. Hoornweg 144 Posted June 30, 2020 4 hours ago, Dave Nottage said: Sorry, I had it confused with another issue. I just had exactly the same issue as you (on a machine I don't use often), and solved it by changing the SDK settings to use build-tools\29.0.3 (instead of 28.0.3) for ZipAlign.exe and AAPT.exe I would be totally grateful if you'd tell me how to do that! I'm an absolute beginner with Android. Share this post Link to post
Dave Nottage 557 Posted June 30, 2020 4 hours ago, A.M. Hoornweg said: I would be totally grateful if you'd tell me how to do that! I'm an absolute beginner with Android. Tools|Options, Deployment > SDK Manager: Share this post Link to post
A.M. Hoornweg 144 Posted July 1, 2020 On 6/30/2020 at 1:00 PM, Dave Nottage said: Tools|Options, Deployment > SDK Manager: It wouldn't work. I have de-installed Delphi Sydney and deleted all Embarcadero folders and registry keys plus everything that had to do with Java and Android. Then I re-installed Delphi and now the compiler deploys the executable as expected. The executable won't start on Bluestacks 4 (screen stays black), however, so I'll try a hardware device next. Share this post Link to post