Forum > Android-JVM

Compile to a tablet?

<< < (2/12) > >>

engkin:

--- Quote from: regressist on October 27, 2021, 02:18:35 pm ---Hi all,
I am sorry if my question is stupid and probably very wrong. My experience with Pascal is limited to programs like the ones in the very old Jensen, Wirth- Pascal User manual and report- 1978 (Yes, 78!), no graphics, no class, no make, etc. Sometimes I revamp it when I need to solve some problems which are too complex for some math packages.
I have successfully written a small program which makes some computations with integers, does not need any input or interactions, and has very little requirements in terms of ram, etc. During execution it writes on screen some numbers to show the status of the computation, at the end it just writes to a file some numbers. It runs on pc, BUT the problem is the CPU usage, if I want to find some solutions I need weeks and probably months. I do  not want to burn my PC. In absence for now of access to a powerful workstation or a mainframe I was thinking to use an old Samsung Galaxy tab, even though slower I would not care if it would die.
So the question is: is there any possibility to compile this program (it is only a basic program) to an .apk which in my dreams would need only to be tapped and starts the computation, again no interaction.
Please note that as an add-on I know nothing also of Android.
Thanks in advance to anybody will take the time to answer

Sergio

--- End quote ---

Hi Sergio,

Are you using Linux or Windows?
Which Galaxy tab do you have? Is it rooted?

Since you are not using any graphical interface, you don't need an apk file. Android includes a terminal. What you need is a cross compiler on your PC and a terminal emulator on your Galaxy. You program as usual on your computer, and when you think your code is ready you cross compile it to produce a version that works on your Galaxy.

Transfer that version to your tablet and run it. This step is a little tricky if you are not familiar with Linux and what you do depends on the Galaxy being rooted or not. In the most common situation,  you copy the program to a specific folder, change its mode to executable, and run it.

regressist:

--- Quote from: engkin on October 27, 2021, 05:30:03 pm ---
Hi Sergio,

Are you using Linux or Windows?
Which Galaxy tab do you have? Is it rooted?

Since you are not using any graphical interface, you don't need an apk file. Android includes a terminal. What you need is a cross compiler on your PC and a terminal emulator on your Galaxy. You program as usual on your computer, and when you think your code is ready you cross compile it to produce a version that works on your Galaxy.

Transfer that version to your tablet and run it. This step is a little tricky if you are not familiar with Linux and what you do depends on the Galaxy being rooted or not. In the most common situation,  you copy the program to a specific folder, change its mode to executable, and run it.

--- End quote ---

Hi and thank you for your reply, also to the others. I am using Windows, I do not know Linux, and the Galaxy is rooted, even though I did it blindly 3 years ago to install version 7 of Android, which now works quite bad, the whole process was a bit disappointing, poor outcome.
The first question would be which cross compiler is available? And the second is the hardest I guess, how can I run the terminal emulator? I remember vaguely that I was able to enter into a tool, TWRP ...

ojz0r:
I have the FPC compiler installed in Termux on my android phone.
This is where i usually do all my (hobby) coding and then compile and run them in the Termux terminal, so no "native" apk.

engkin:

--- Quote from: regressist on October 27, 2021, 08:30:17 pm ---The first question would be which cross compiler is available?

--- End quote ---

On Windows I used to used Laz4android.
What version of Windows are you using?
What model number is your Galaxy?


--- Quote from: regressist on October 27, 2021, 08:30:17 pm ---And the second is the hardest I guess, how can I run the terminal emulator? I remember vaguely that I was able to enter into a tool, TWRP ...

--- End quote ---

For terminal emulator I used to use this one

For your purpose, the first difference between Windows command line and Android terminal is permission to run an app. The executable on Windows has exe extension, while on Linux it has no extension. If you copy an executable from your PC to Android you need to change its mode to make it executable using chmod:

chmod 755 ./yourFileName

I used to put my test files in /data/local/tmp/ folder, then change their mode, and run them

Unlike Windows, in Android/Linux terminal to run an executable located in the current directory you need to add a period and a slash ./ before the executable:
./test


I forgot to mention, if you have the drivers for your Galaxy installed on your Windows, you can use ADB (Android Debug Bridge) on your Windows to copy files, change their mode, and run them from within WIndows itself. Also, you can use an open source application called scrcpy to see your Galaxy on your Windows screen. ADB and scrcpy should help while working on your app if you prefer to use one screen/keyboard/mouse instead of switching back and forth between the two devices.

regressist:

--- Quote from: engkin on October 27, 2021, 09:06:36 pm ---
On Windows I used to used Laz4android.
What version of Windows are you using?
What model number is your Galaxy?

For terminal emulator I used to use this one

For your purpose, the first difference between Windows command line and Android terminal is permission to run an app. The executable on Windows has exe extension, while on Linux it has no extension. If you copy an executable from your PC to Android you need to change its mode to make it executable using chmod:

chmod 755 ./yourFileName

I used to put my test files in /data/local/tmp/ folder, then change their mode, and run them

Unlike Windows, in Android/Linux terminal to run an executable located in the current directory you need to add a period and a slash ./ before the executable:
./test

I forgot to mention, if you have the drivers for your Galaxy installed on your Windows, you can use ADB (Android Debug Bridge) on your Windows to copy files, change their mode, and run them from within WIndows itself. Also, you can use an open source application called scrcpy to see your Galaxy on your Windows screen. ADB and scrcpy should help while working on your app if you prefer to use one screen/keyboard/mouse instead of switching back and forth between the two devices.

--- End quote ---

The Galaxy is 10.1, I am using a virtual machine XP (VMWare) for Lazarus to avoid cluttering the PC.
I appreciate a lot the time you are wasting to answer to me, but I have to say that it's unlikely I will succeed, I know practically nothing of what you are saying and do not know where to start!! I will try of course, I like too much your solution...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version