Recent

Author Topic: controls.lpr(731,15) Error: Error while linking in laz4android3.4  (Read 6417 times)

Bandy

  • Jr. Member
  • **
  • Posts: 84
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #30 on: July 09, 2025, 10:41:42 am »
I configured my phone to debug mode/developer options and pluged it to my computer usb port.
In LAMW4Windows, I selected "Run" -> "[LAMW] Build Apk and Run" but got Fatal: [Exception] Failed: Cannot run APK!

These are all my Messages:

Messages, Hints: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: C:\Users\Andy\Desktop\Android\AppLAMWProject2\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\Users\Andy\Desktop\Android\AppLAMWProject2\obj\controls\controls.o"
Note: Duplicate unit "controls" in "LCLBase 3.8", ppu="C:\lamw_manager\LAMW\LAMW4Windows\lazarus_trunk\lcl\units\arm-android\controls.ppu", source="C:\lamw_manager\LAMW\LAMW4Windows\lazarus_trunk\lcl\controls.pp"
Project: Executing command before: Success
before build...
Compile Project, OS: android, CPU: arm, Target: C:\Users\Andy\Desktop\Android\AppLAMWProject2\libs\armeabi-v7a\libcontrols.so: Success
Project: Executing command after: Success
after build...
Building APK (Gradle)... : Success
Starting APK (Gradle)... : FAILURE: Build failed with an exception., Errors: 1
Fatal: FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 8s
34 actionable tasks: 1 executed, 33 up-to-date
Exception, Errors: 1
Fatal: [Exception] Failed: Cannot run APK!

dseligo

  • Hero Member
  • *****
  • Posts: 1674
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #31 on: July 09, 2025, 11:44:40 am »
> com.android.builder.testing.api.DeviceException: No online devices found.

This is your problem. Maybe you didn't accept connection on the phone after connecting it to the computer.

You can check available devices with 'adb' tool in command line like this (it should be one entry below text 'List of devices attached'):
<path to Android SDK location>\sdk\platform-tools\adb devices

Until you don't have your device listed here, you won't be able to upload apk to the phone. Try different cable.

After you succeed to connect your phone to your computer, you can also use Wifi to connect to your phone.
But it must be connected via USB cable first to start server on the phone:
<path to Android SDK location>\sdk\platform-tools\adb tcpip 5555

After that you can connect to the phone with this command (change IP address to that of your phone):
<path to Android SDK location>\sdk\platform-tools\adb connect 192.168.1.123

Another thing.
After you succeed in connecting your phone, you might want to change architecture from armeabi-v7a to Aarch64.

Bandy

  • Jr. Member
  • **
  • Posts: 84
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #32 on: July 09, 2025, 02:53:02 pm »
I didn't accepted connection on the phone after connecting it to the computer. My device is listed in 'List of devices attached', see attachment. Now I have a working Hello World app for armeabi-v7a. Thank you, dseligo, you're a HERO!!!

Why do you recommend changing architecture from armeabi-v7a to Aarch64 and where do I make this modification?
LAMW4Windows will work if I update Windows 10 to Windows 11?
« Last Edit: July 09, 2025, 03:00:44 pm by Bandy »

dseligo

  • Hero Member
  • *****
  • Posts: 1674
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #33 on: July 09, 2025, 03:25:04 pm »
I didn't accepted connection on the phone after connecting it to the computer. My device is listed in 'List of devices attached', see attachment. Now I have a working Hello World app for armeabi-v7a. Thank you, dseligo, you're a HERO!!!

Great, glad it worked. :)

Quote
Why do you recommend changing architecture from armeabi-v7a to Aarch64 and where do I make this modification?

I recently had one project and armeabi-v7a didn't work on my Phone (Galaxy S23). If it's working for you, you don't have to change it (armeabi-v7a is 32-bit, and Aarch is 64-bit, and different instruction set).

You change architecture in Project Options, [LAMW] Android Project Options, Build. You have Chipset setting there. After change do 'Clean up and Build' in Lazarus.

Quote
LAMW4Windows will work if I update Windows 10 to Windows 11?

I guess it will. I have Windows 11, I installed it with FPCUPdeluxe.

P.S.: Added where chipset is changed.
« Last Edit: July 09, 2025, 03:34:29 pm by dseligo »

dseligo

  • Hero Member
  • *****
  • Posts: 1674
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #34 on: July 09, 2025, 03:31:46 pm »
I don't know where demo apps are located.

I want to answer you to this, because there are many demos and they are really useful. Some of them need some tweaking to work (mostly change architecture).
I have them in:
<Lazarus install directory>\fpc-lazarus\ccr\lamw\demos\GUI

Guser979

  • Jr. Member
  • **
  • Posts: 69
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #35 on: July 09, 2025, 11:22:13 pm »
About the error " Error while linking :"

Don't forget to export the configuration that's working for you now. It may be helpful:

Go to
Menu: Project > Project Options > Compiler Options > Paths

And the "Export" button

Example:

Open a LAMW demo

Go to
Menu: Project\Project Options\Compiler Options\Paths\

And the "Import" button

Go to
Menu: Project > Project Options > [LAMW] Android Project Options
And make sure the Target SDK Version is correct and
Make sure the Chipset is correct.

Make sure the demo's JNI folder contains the following files:

\jni\after_build.sh
\jni\before_build.bat
\jni\before_build.sh
\jni\after_build.bat

If they don't exist, you can copy them from any JNI folder where a compilation was successful.

Then, Compile. If no errors occur, you can try building and running the APK.

Note 1:
Some errors may occur related to AndroidManifest.xml (very old, etc.), in which case you will need to update this file to meet the new requirements.

Note 2:
It may also be necessary to convert to a suitable theme.

Go to:
Menu: Tools > [LAMW] Android Module Wizard > Convert the project to AppCompat Theme

This conversion may cause an error.

Usually, simply close the project and reopen it,
 and making sure the theme is correct.

Go to:
Menu: Project > Project Options > [LAMW] Android Project Options

A compatible theme should appear in the Application tab.

Bandy

  • Jr. Member
  • **
  • Posts: 84
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #36 on: July 10, 2025, 12:55:34 pm »
Now... about Write Once, Compile Anywhere. I have an app for Windows written in Lazarus IDE v4.0 for Windows. How can I just compile it for Android?

tetrastes

  • Hero Member
  • *****
  • Posts: 755
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #37 on: July 11, 2025, 11:50:29 am »
You can't. Except your program is for command line and you don't use any OS specific stuff.

Bandy

  • Jr. Member
  • **
  • Posts: 84
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #38 on: July 12, 2025, 11:05:41 am »
And what does Write Once, Compile Anywhere mean?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12207
  • Debugger - SynEdit - and more
    • wiki
Re: controls.lpr(731,15) Error: Error while linking in laz4android3.4
« Reply #39 on: July 12, 2025, 11:44:05 am »
And what does Write Once, Compile Anywhere mean?

It means, that it is possible to write code (i.e. "some code") that compiles "anywhere" (on all FPC supported targets).

It does not mean, that any or every code written will do that. Obviously, e.g. code directly using Android only features wont compile on the Amiga (and less obvious cases also exists...).


Yes, I am aware that this answer is not helpful. But since you are pushing this question (which doesn't solve your problem), well this is the answer (or rather "an answer").


As for your original question(s): Sorry, I don't have any Android background myself. So I can't answer that.

 

TinyPortal © 2005-2018