Running a go program on Android? - android

I have a go library that i want to run on android and use its methods in my android app. I could write the whole android app in go to make it easier to use this dependency. Is this possible? If so, how?

Download Termux (Linux Emulator) from google play store and open it.
Next, wait for it to perform an automatic download of its resources. After that operation, the run the following command:
pkg install golang
pkg install git
The got package is required when downloading golang packages.
Eventually, you can test it by running (go) command.

Golang support for mobile development has been steadily improving. Today it is even possible to build some simple all Go apps (depending on which features you need) as well as Go libraries. Please see https://github.com/golang/go/wiki/Mobile for more info.
UPDATE: In further improvement, libraries are being created to support even UI on mobile platforms. https://fyne.io provides rather robust set of features for mobile.

You can use a Go library from Java when developing for Android with gobind (see this example in the gomobile repository). The biggest issue with this is integration into the build system.
For Go 1.5 things are getting better, but you'll have to wait for that.

Related

AOSP - Building custom images and running them with Android emulator on SDK

I am currently building custom images using the Android Open Source Project. I would like to send these custom images (system.img, ramdisk.img, cache.img, etc.) to a friend so that he/she can run them without having to compile the entire AOSP branch. Note that they "do" have the latest official Android SDK (not AOSP).
Is there a way to do this? Ideally, I was hoping for some make target that already exists where I can simply run it (make avd-package) and an "avd" (or something close to it) would pop out so that I can just send it to my friend and have them type:
emulator -avd
Also, from my research, the fact that I want these images to be runnable by the normal Android SDK (not AOSP) might present a problem since the tools in the Android SDK are different than the ones in AOSP (e.g. qemu versions, etc.). Would I also need to send my friend the emulator binaries as well?
Thanks!
Yes, it is doable. You need to create some metadata and upload it to a public server so that your users can get the URL. This is the URL they can then enter in Android Studio for using it with the SDK Manager tool.
For full instructions follow the official docs here: https://source.android.com/setup/create/avd

"Standalone" Android Apps with Python?

It's known you can run Python on Android with QPython, but first users have to download and install it on their phone.
Just wondering: is it possible to pack QPython dependencies together with "app" script creating a "standalone" PlayStore-ready .apk?
It's not a direct answer to your question, but you can create totally standalone apks with the graphical framework kivy, or specifically kivy's android build tools. They only directly support apps with a kivy gui, but this is easy to construct if you just want to run a simple script.
Alternatively, I think you actually only need to put your code in a kivy App class, which will run the script but then immediately exit if you don't define any graphics. Maybe this is exactly what you want.

Android build environment

I have been working with standard android for some time. Recently I have been building android sdk for windows and find some interesting things in Android build env. There is a command called lunch which can be used to list all available targets to build. However, it does not list sdk and its variants,even though they are valid options.
Does anyone know why is that the case?
Also can I build any specific module in Android sdk without building the whole sdk. (It could be a great help as I dont wanna build the whole sdk, if I gonna do a small change in one component.)
Thanks
Under the hood, lunch uses make, so if some pieces of SDK do not change, they won't be rebuilt.
My speculation about your first question: rebuilding SDK was never considered a major task of lunch. It is most often used to port or mod the system and produce an installable system image, and receive the ADK as by-product. Later, people realized that often (with root access to the device) you can iterate over one component without need to reinstall the whole system image.

Opening android AOSP native applications in eclipse

I need to edit the original Android Apps from packages
in terms make my own distro/mod..
I want to make changes to the In Call screen, lock screen, contacts, calendar etc..
I understand that for doing this I will have to build everything from
source,
however I need to edit the source and to do so I need to open the OS provided apps as
eclipse projects,
When I did I saw that there are
missing imports which are hidden in the SDK (or missing)
hidden parameters within the classes..
I don't want to use reflection since the whole code is here and
available, but how do you build a platform development kit..
or PDK ?:)
Can any one help?
You start by reading the documentation.
EDIT:
If you are trying to download some single project from AOSP and compile it using the SDK, odds are very strong that it will not work, and that you will encounter problems like the ones you cite. You do not build Android by building individual apps; you build Android ("my own distro/mod") by building the entire firmware. Most AOSP applications are not designed to be compiled by the SDK, but need the whole firmware.
Please check Using eclipse to browse and edit AOSP. You can atleast edit your code using eclipse, but you will have to use AOSP build system to build your distro.
You might also check Debugging Android Java Framework services as that would help debug your changes.
Just open Eclipse,
then go to "window" +"preferences" +"android"
there you will get sdk location,then give the appropriate path of the android sdk for proper run...

Build Android app to run in JRE

I have seen questions and topics in google referencing running JRE apps in the android environment, but I am actually thinking about the reverse.
I understand Android runs on a different runtime engine than the standard JRE.
Is it possible to build an app to run on android, but also build and run the same app in the JRE on a desktop?
I assume there would be restrictions on API usage, I was just thinking about the possibility to distribute a simple app that could be useful on both the device and the desktop.
I think the bigger problem here is going to be accessing the Android API and environment on your desktop. Do you have a plan for that?
If you have the Android environment running on your desktop then there shouldn't be any problem running your app there.
This answer offers an alternative suggestion.
Short answer: your desktop and Android app can share a large portion of code, but you aren't going to be able to run Android-specific code on the desktop.

Categories

Resources