Articles Linker error using the sensor components for Android in RAD Studio 10.3.3 by David Millington

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,439
Credits
574
Linker error using the sensor components for Android in RAD Studio 10.3.3
[SHOWTOGROUPS=4,20]
David Millington
25/2/2020

An issue in Androidapi.Sensor.pas referring to symbols introduced in SDK version 26 will cause an linking error when your app references SDK version 22.

If you are building Android applications with C++Builder 10.3.3, you may encounter an error [ldandroid Error] "ld" exited with code 1. The same issue can appear with different symptoms for Delphi 10.3.3 when attempt to match symbol names (such as using a script to gain symbols from call stacks generated by third party call stack libraries on Android, such as Для просмотра ссылки Войди или Зарегистрируйся) in Delphi, where you will also get a linker error.

The issue is caused by a few symbols in the Androidapi.Sensor.pas file only being introduced in Android SDK version 26, but your application will link against version 22 where those symbols are not present. To resolve the errors, just make a local copy of the unit and comment out the symbols.
Workaround
  1. Find the C:\Program Files (x86)\Embarcadero\Studio\20.0\source\rtl\android\Androidapi.Sensor.pas and Androidapi.inc files (or the same file in your RAD Studio installation folder, if you installed to a different location.)
  2. Make a copy of them in your project's source folder, and addAndroidapi.Sensor.pas only to your project. Androidapi.inc is required to build your local copy of Androidapi.Sensor.pas.
  3. Open the file and locate and comment out the declarations for the following symbols:
    1. ASensorManager_getInstanceForPackage
    2. ASensorManager_getDefaultSensorEx
    3. ASensorManager_createSharedMemoryDirectChannel
    4. ASensorManager_createHardwareBufferDirectChannel
    5. ASensorManager_destroyDirectChannel
    6. ASensorManager_configureDirectReport
    7. ASensorEventQueue_registerSensor
    8. ASensor_isDirectChannelTypeSupported
    9. ASensor_getHighestDirectReportRateLevel
  4. Ensure that when you upgrade to the next version, you remove your local copy of this file from your projects.
Writeup
Brian Long kindly wrote up a Для просмотра ссылки Войди или Зарегистрируйся. Thanks Brian!

[/SHOWTOGROUPS]
 
Последнее редактирование: