-
Content Count
47 -
Joined
-
Last visited
-
Days Won
1
Posts posted by tomye
-
-
On 1/5/2025 at 1:29 AM, Patrick PREMARTIN said:Thank you for these clarifications. Seen from this angle, the choice was a logical one. 🙂
i finished the rknn frame to Delphi and opensource it , see at https://github.com/13501714030/rknn4Delphi
-
On 1/5/2025 at 1:29 AM, Patrick PREMARTIN said:Thank you for these clarifications. Seen from this angle, the choice was a logical one. 🙂
i finished the rknn frame to Delphi and opensource it , see at https://github.com/13501714030/rknn4Delphi
-
1
-
-
On 1/17/2025 at 9:16 AM, bravesofts said:Resolving .idsig Issues in Delphi Android Apps
Understand the .idsig File Role
The .idsig file is generated during APK signing with APK Signature Scheme V2/V3.
It ensures APK integrity. Deleting it forces fallback to legacy signing (V1).
Update Your SDK Tools
Use the latest Android SDK and Build Tools compatible with Delphi.
Ensure Android SDK Build Tools 30.0.0 or higher is installed.
Verify SDK paths in Tools > Options > SDK Manager.
Prevent App Disappearance After Reboot
Ensure consistent and trusted APK signing with a proper keystore.
Avoid modifying the APK (e.g., deleting .idsig) after signing.
Test on Multiple Devices
Test your app on various devices and Android versions, focusing on 7.0 and above.
Check for Manufacturer-Specific Issues
Investigate device-specific forums for issues with customized Android versions.
Use Logcat for Debugging
Gather installation/runtime logs using:
adb shell logcat | grep "com.yourCompany.yourAppName"
Share the log file with us here for further analysis.
*Always use at least Android SDK Build Tools 30.0.0 or higher to avoid outdated signing issues.*
thank you , help me a lot 🙂
-
1
-
-
This issue has been troubling me for a long time. When developing Android applications with Delphi, a .idsig signature file is automatically generated after compilation. However, on some Android systems, this signature file is rejected. The APK can be installed, but it either fails to run or, after a system reboot, my app disappears. There are many problems like this. I can only delete the .idsig file to proceed with the installation, and in most cases, it works fine. However, occasionally, the app still disappears after the Android system reboots. How should I properly configure this .idsig file?
-
On 12/28/2024 at 11:23 PM, Patrick PREMARTIN said:Hi.
In your project, do you think an other language could have been better or Delphi was a good choice ?
What's missing from the docs or the web in general that could have helped us go faster or more efficiently?
I am 49 years old and have been using Delphi since 1999. I don't know any other programming languages—or rather, I should say that I have been deeply entrenched in Delphi's programming paradigm.
I used to primarily develop client-server (C/S) projects, spending nearly 20 years writing code of this kind. Over time, I grew to dislike it. Fortunately, in recent years, I’ve had the opportunity to work more with hardware-related tasks, which means I no longer have to develop database or UI-related code. This change has made me very happy, and I really enjoy writing code that interacts with hardware.
Since I develop products related to drones, I have to handle camera data streams and figure out how to transmit images to the ground. In recent years, the industry has increasingly relied on AI, so I’ve also added AI-related features to my work. It took me nearly two years to implement all these functionalities. In the end, I found that the programs I wrote in Delphi performed just as well as those written in native Android Java, and sometimes even better. When compared to C++ programs on Linux, Delphi's performance is slightly weaker, but I believe this gap comes from the operating system itself rather than being an issue with Delphi.
My next step will be to try porting my current projects to Linux, even though I’ve never used Delphi to develop Linux applications before.
-
2
-
-
Developing mobile applications using Delphi is definitely feasible, but the resources available for reference are quite limited. If your project is focused on basic features like UI and database operations, it should work well. However, I recently completed an app related to video processing, which also integrates TensorFlow Lite for AI recognition and several trackers from OpenCV. The main features include:
- Hardware encoding with FFmpeg
- Hardware decoding with FFmpeg
- Streaming and receiving camera data
- Integration of a streaming server
- Embedding the KCF tracking algorithm
- Embedding OpenCV's built-in Nano tracker
- Embedding OpenCV's built-in ViT tracker
- Integration of the TensorFlow Lite inference framework
These features took me over a year to complete.
Next, I plan to integrate the RKNN inference framework from Rockchip and migrate the entire project to Linux.
In conclusion, developing mobile applications with Delphi can be quite painful and challenging, requiring strong determination and patience.
-
On 5/11/2024 at 4:05 AM, Dave Nottage said:I sincerely doubt that is the only way, however since you refuse to give a more complete example (not in a screenshot, and something that is sufficient to reproduce the issue), it's difficult to find an answer.
Good luck
finally, i solved the problem
there is a file which is named AndroidManifest.template.xml
i modified this code
... <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" /> ...
to
... <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="30" /> ...
re-build and run , it does work now on D12
-
i have known the reason.
the isssue comes from the java sdk version, the high version (D11.2 to D12 used) doesn't support the current TFLite GPU delegate
i copy the D11 PAClient to D12 and got an error message:
[PAClient Error] Error: E7688 java.lang.UnsupportedClassVersionError: com/embarcadero/dexer/Main has been compiled
by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
At the time of Delphi release, it was bundled with the java sdk version
the only way is i have to upgrade the TFLite GPU delegate ( libtensorflowlite_gpu_jni. so ) to high version, maybe it can be supported.
thank you for your all help
-
-
2 hours ago, Dave Nottage said:Your example is a bit light on details - how are all these defined?
InterpreterOptionsAddDelegate
InterpreterOptions
GpuDelegate
InterpreterCreate
ModelRegardless, have you used a logcat viewer to look for related messages (error, or otherwise)?
i can't get detail error message, beacuase it calls .so library file
only return a nil object
but it doesn't happen on D11
-
I am using the inference library provided by Tensorflow Lite, and calling it in Delphi to implement AI inference
Tensorflow Lite can support GPU inference well on mobile phones, greatly improving the inference speed
CPU inference speed:
GPU inference speed:
I call the libtensorflowlite_gpu_jni.so of Tensorflow Lite
LibHandle := System.SysUtils.LoadLibrary(PWideChar('libtensorflowlite_gpu_jni.so')); InterpreterOptionsAddDelegate := GetProcAddress(LibHandle, 'TfLiteInterpreterOptionsAddDelegate');
And add a GPU delegate during program initialization
InterpreterOptionsAddDelegate(InterpreterOptions, GpuDelegate); Interpreter := InterpreterCreate(Model, InterpreterOptions);
The problem occurs here, before I used D11, the Interpreter can return an object pointer
But after upgrading to D12, it will return a nil, unable to call the GPU, I also tried D11.2 and D11.3
It's the same, all return a nil, only D11 can return an object pointer, and smoothly call the GPU on the phone
I thought it might be caused by the upgrade of the Java SDK or NDK version, but after importing the Java SDK and NDK library used by D11, the problem still cannot be solved
I am unfamiliar with Java, and in Delphi's SDK Manager, there seem to be only 3 SDK configurations, namely sdk, ndk, and jdk
I don't know what these 3 SDKs represent, and I vaguely feel that the versions of these 3 libraries are not correct, causing my problem
But I also tried to replace all 3 SDKs with the ones used by D11, and it still doesn't work
During testing, I found a detail, I use the following code to call Toast
unit Android.Toast; interface {$IFDEF ANDROID} uses FMX.Platform.Android, Androidapi.Helpers, Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.JNI.GraphicsContentViewText; {$ENDIF} {$IFDEF ANDROID} type TToastLength = (LongToast, ShortToast); JToast = interface; JToastClass = interface(JObjectClass) ['{69E2D233-B9D3-4F3E-B882-474C8E1D50E9}'] { Property methods } function _GetLENGTH_LONG: Integer; cdecl; function _GetLENGTH_SHORT: Integer; cdecl; { Methods } function init(context: JContext): JToast; cdecl; overload; function makeText(context: JContext; text: JCharSequence; duration: Integer) : JToast; cdecl; { Properties } property LENGTH_LONG: Integer read _GetLENGTH_LONG; property LENGTH_SHORT: Integer read _GetLENGTH_SHORT; end; [JavaSignature('android/widget/Toast')] JToast = interface(JObject) ['{FD81CC32-BFBC-4838-8893-9DD01DE47B00}'] { Methods } procedure cancel; cdecl; function getDuration: Integer; cdecl; function getGravity: Integer; cdecl; function getHorizontalMargin: Single; cdecl; function getVerticalMargin: Single; cdecl; function getView: JView; cdecl; function getXOffset: Integer; cdecl; function getYOffset: Integer; cdecl; procedure setDuration(value: Integer); cdecl; procedure setGravity(gravity, xOffset, yOffset: Integer); cdecl; procedure setMargin(horizontalMargin, verticalMargin: Single); cdecl; procedure setText(s: JCharSequence); cdecl; procedure setView(view: JView); cdecl; procedure show; cdecl; end; TJToast = class(TJavaGenericImport<JToastClass, JToast>) end; var PToast:JToast; procedure Toast(const Msg: string; duration: TToastLength = ShortToast); {$ENDIF} implementation {$IFDEF ANDROID} uses FMX.Helpers.Android; procedure Toast(const Msg: string; duration: TToastLength); var ToastLength: Integer; begin if duration = ShortToast then ToastLength := TJToast.JavaClass.LENGTH_SHORT else ToastLength := TJToast.JavaClass.LENGTH_LONG; CallInUiThread( procedure begin //TJToast.JavaClass.makeText(SharedActivityContext, StrToJCharSequence(Msg), //ToastLength).show if not Assigned(PToast) then PToast:=TJToast.JavaClass.makeText(SharedActivityContext, StrToJCharSequence(Msg), ToastLength) else begin PToast.setDuration(ToastLength); PToast.setText(StrToJCharSequence(Msg)); end; PToast.show; end); end; {$ENDIF} end.
Using this Toast in D11, there is no icon displayed in the Toast prompt, but GPU can be called normally
However, in D11.2, D11.3, and D12, when calling, an icon will automatically appear in the Toast prompt, but the GPU cannot be called
From this phenomenon, it is inferred that the SDK version with the icon should be a higher version, that is, the higher version of the SDK cannot call the GPU
So, how can I make D12 use a lower version of the SDK now (i believe the no icon version should be worked)?
(I have tried specifying a lower version of the SDK in the SDK Manager, but the Toast still displays an icon and the GPU cannot be called)
-
i worte a python script , it can be run on PyCharm very well
but can not be run on P4D, always get an error:
OSError: [WinError 182] The operating system cannot run %1。 Error loading "C:\ProgramData\Miniconda3\envs\YoloV8\lib\site-packages\torch\lib\nvfuser_codegen.dll" or one of its dependencies.
i found the nvfuser_codegen.dll and checked it all dependencies does exits, howevery if missing dependencies why i can run on PyCharm?
I have tried all the methods I can try, but they are all failed.
anyone can help me ?
-
Hi, anyone knows how to make the window style when i using a Stylebook component?
it does not work on windows just works on components,
is there any way to resolve it?
Thanks for all
Tom
-
20 hours ago, pyscripter said:iOS is supported.
For Android look at the Embarcadero fork.
quick view the forked Android project, seems very complex, must use Delphi4Python ?
and the iOS reference, i couldn't find anything about how to deploy the Python on iOS,
just found some P4D FMX demos at https://github.com/pyscripter/python4delphi/tree/master/Demos/FMX
these demos can be run on iOS ? thank you
-
Recently, I have been using P4D for a long time and it is becoming more and more convenient.
I would like to ask whether the P4D supports Android and iOS?
if not do you have any planning ?
thanks for creating so good stuff.
Tom
-
12 hours ago, pyscripter said:Running python in threads does not increase python code speed due to the GIL. Only one thread executes at any point in time. Torch can do its own mutli-threading so again there is no need to use threads. The main reason for using python threads is to avoid blocking the UI.
Yes, Torch is much better than onnx, i have tested.
yesterday, i droped the thread mode and create a new project without thread mode
but still got this error:
very strange, if i run the onnx script first and then run the torch script , then will get this error ,
but if i run the torch script first and then run the onnx script , all are ok
i think it should be an old version of CUDA dlls is called if the onnx script runs first and torch does not support this version
but the onnxruntime supports the high version which the torch is used, that's why if i run the torch script first everything is ok.
-
On 10/31/2022 at 7:24 PM, shineworld said:Sincerely, I've used an embedded version of Python with minimal packages installed, and the required files are few.
In Embarcadero GitHub repositories you can find a distro ready to be used.
No anaconda, conda, or virtual environment.
Just point to python dll with P4D and the joke is made.
You can also avoid calling a pure py script ad use Embarcadero P4D-Data-Sciences,
PythonEnvironments and Lightweight-Python-Wrappers and remain always on the Delphi project.
For markers detection, you can always extract the math and logic of FindContours HougCircles. etc from OpenCV sources,
as suggested by the name they are open but you have to use something like to NumPy.
I don't like re-invent the wheel when it is already done so I've discarded the idea to re-write all math in pure pascal code,
although the related math (find counters, HougCircles, etc) is very simple, but very well implemented in OpenCV.
What they have done in embarcadero with P4D and related tools is very important and allows them not to reinvent hot water by going direct to the use of tools born for scientific purposes.
dear shineworld, If you don't involve a lot of deep learning capabilities, i recommend the MITV Lab Packages, all are native compilation , does not need Python
-
15 hours ago, pyscripter said:Why are you making things complicated? Follow the KISS rule. Using threads in this way requires deep knowledge of the Python API and the complexities of GIL.
If do have to use threads, please study Demo 11 and the related posts in this forum Showing results for 'Py_Begin_Allow_Threads'. - Delphi-PRAXiS [en] (delphipraxis.net)
I don't want it to be that complicated either, but Python's performance is too low
if i don't use thread to run , the speed and GPU useage % as below:
if i lanuch 2 threads :
if i lanuch 3 threads:
single fps will be reduced but Avg fps will be raised if i use 3 threads
so this is only way i can figure out to up the speed. 😞
acutally, i have finished the thread mode program running in the past months
but recently, i changed the AI engine from ONNX to TORCH, after installed pytorch
everything becomes unsteady, but if i switch the pythone envirnoment to old path
everything comes back , very steady. i feel the issue comes from CUDA apis and CUDA envirnoment
but i still can not find it out, so come here for help . 😞
-
9 hours ago, pyscripter said:PythonHome needs to be set even for registered conda distributions
See TPythonVersion.AssignTo(PythonEngine: TPersistent); in PythonVersions.pas about this is done.
Note also that for conda distributions to work properly,
you need to add Format('%s;%0:s\Library\bin;', [Version.InstallPath]
to your Windows path if it is not there already.i found this issue comes from the P4D thread mode
i am not sure if it is P4D BUG because now i can run the script in P4D Demo01 after i PIP INSTALL PYSQLITE3,
but still can not be run in my project, will raise an error:
could not find cudnn_adv_infer64_8.dll or one of its dependent file
the cudnn_adv_infer64_8.dll and all of its dependent files are existing
as i said, i set
TPythonThread.Py_Begin_Allow_Threads;
in my code, and all running are in thread mode, i don't know if the Python path is lost in thread mode
-
7 hours ago, pyscripter said:Set AutoLoad to False and call LoadDLL at Runtime (e.g. in your FormCreate).
Yes, i did , but does not work , so i post the question on here
does the P4D not support LOADDLL and UNLOADDLL dynamic call ?
for example:
i launch the exe and call the LoadDLL function at first time
after run one script i need reset a new DLL path and call LoadDLL again,
how to do like this?
-
if write like this , got an error : There is already one instance of TPythonEngine running
the P4D can not change Python DLLs in runtime ?
-
dear shineworld may i ask you how old are you?
-
7 hours ago, SwiftExpat said:Anaconda shows to be 64 bit, what platform are you targeting in Delphi?
my project is 64-bit
the anaconda which i installed is 64-bit
the python dependent libraries are all 64-bit
-
9 hours ago, pyscripter said:Is there another sqlite dll in your path?
actually , i don't know why the torch uses the SQLite, however , i searched the DLL files, they are all there and all of them are 64bit
and this error message ( Not a valid win32 application ) is only appear on P4D Demo01, but in my project, there is another error message
the error message is : OSError: [WinError 127] The specified program could not be found
same script i could run it in Python envirnoment, but can not be run in P4D , BTW, my project uses P4D thread mode ( TPythonThread.Py_Begin_Allow_Threads; )
and then i test the script in P4D Demo01, got an another error message: Not a valid win32 application 😞
Delphi for Mobile Applications
in Cross-platform
Posted
the rknn4Delphi only supports ROCKCHIP chip's products, the Android must be run under their chip then you can use the rknn4Delphi
i highly recommond the ORGANGEPI, see at http://www.orangepi.org/
their product which is named Pi5B, only USD80, built-in rk3588s, has 3 cores of NPU and their Pi3B built-in rk3566 with single core of NPU only USD35
https://item.taobao.com/item.htm?id=711193432489&pisk=g9fZbVThj5FN8X_PA_AqLFRKUGY6ZIr77stXoZbD5hxMfssVoEYrjfvMnwYHuHGbWCwvgi-FDh96ssWKgaQA1PdbWCQ9MIq7V7tVWNdYhJswxsRH-ET8GxcMSCd3fiHiJ7N5Wwu6Sz_3N19k4vYinjjDIpAHkHcmihjDtHY9xfYmsIx38HLDiFDMmvmHyEDMSnjmxBYXuVcMmhvH-FLwinjmsy7HvElMvsfZThJguGofCuDLydKlSHlma4LwIu7Zhjl2PFvNZZKFd91e7d-WpGoWN1jCo119p-D2Mw6P0tjYFvdNoOAMPNFZTQbGds8CGrM2jGCF-19EzbRNnGC2BOuYywAGvTKJIJEp811W33pExlbC8hvP3GZKih6P-MJ5ODGWMMBcmESnbgPqDe0JcsHEixJMJe-78yPvSj2ba-JoTxHvKyLeVzzrHxpGve-78ykxHpYJ83azz&spm=a1z10.1-c-s.w4004-23020891405.24.52168ec18wwe34&skuId=4983526316401