Developing and running D GUI app on Android

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jan 13 02:02:16 UTC 2021


On Sun, Jan 10, 2021 at 06:58:13PM +0000, aberba via Digitalmars-d-learn wrote:
> I'm looking to explore running a D application on Android based on
> Adams previous foundation work. However, I'm not familiar with the
> Android + D integration so I need some help.
> 
> Has any of you successfully done that? Could use a sample code or
> anything I can use to figure out how to start.

First, you need a way to build an APK, and then transfer that to your
Android device for testing.  Building an APK *can* be done manually
(well, scripted), but I don't recommend it.  The simplest way is
probably to install Android Studio and the Android SDK, and use Gradle
to build your project.  Gradle takes care of the finicky details of how
to build an APK, and the Android dev tools let you install to Android in
debug mode without having to find your own way of transferring APKs.

For compiling D, you'll need LDC configured to cross-compile to Android:

	https://wiki.dlang.org/Build_D_for_Android

Talk to Adam for more details -- he has done some work to remove some of
the manual munging described on that page, but I don't remember how
much.  For maximum convenience, you probably want to figure out how to
integrate your build process with Gradle so that it can be done with a
single command.  (I opted not to use Gradle, but an SCons-based system
that's actually very fast at cross-compiling D and building APKs. But
most people will probably want to use Gradle.)

Most of the hard work is the setup; once you have a working environment
writing D for Android is pretty smooth.  Esp. with Adam's jni.d,
interacting with Android's Java APIs ought to be a lot easier than ever.

If you have more specific questions I can try to answer them.


T

-- 
If it's green, it's biology, If it stinks, it's chemistry, If it has numbers it's math, If it doesn't work, it's technology.


More information about the Digitalmars-d-learn mailing list