www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - D for Android beta

reply Joakim <dlang joakim.fea.st> writes:
The beta release of ldc 1.3, the llvm-based D compiler, is now 
out:

https://github.com/joakim-noah/android/releases

It is accompanied by a non-trivial sample app from the Android 
NDK, ported from C++ to about 1.2 klocs of D: the classic Utah 
Teapot (https://en.wikipedia.org/wiki/Utah_teapot), updated with 
mobile touch controls.  This app also demonstrates calling Java 
functions from your D code through JNI, though most of it is 
written in D.

There are two builds of ldc, a cross-compiler that you can use 
from a linux/x64 shell to compile to Android/ARM, and a native 
compiler that you can run on your Android device itself.  As I 
pointed out last year, not only is ldc a large mixed D/C++ 
codebase that just worked on ARM, but it is possible to build 
arbitrarily large Android apps on your Android device itself, a 
first for any mobile platform:

http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

This is the way the next generation of coders will get into 
coding, by tinkering with their Android devices like we did with 
Macs and PCs decades ago, and D is one the few languages that is 
already there.

I will write up instructions on how to write an Android app in D 
_on_ your Android device by using ldc and the Termux app, and get 
ldc into the Termux packages, a package repository for Android:

https://play.google.com/store/apps/details?id=com.termux&hl=en
Jun 01 2017
next sibling parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
Very exciting! :)

On 06/01/2017 12:31 PM, Joakim wrote:

 I will write up instructions on how to write an Android app in D _on_
 your Android device
I hope it will be detailed enough for people who are very new to programming on the Android. Ali
Jun 01 2017
next sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Thursday, 1 June 2017 at 19:45:17 UTC, Ali Çehreli wrote:
 Very exciting! :)
+1!
 On 06/01/2017 12:31 PM, Joakim wrote:

 I will write up instructions on how to write an Android app
in D _on_
 your Android device
I hope it will be detailed enough for people who are very new to programming on the Android.
Me too :D mt.
Jun 02 2017
prev sibling next sibling parent Joakim <dlang joakim.fea.st> writes:
On Thursday, 1 June 2017 at 19:45:17 UTC, Ali Çehreli wrote:
 Very exciting! :)

 On 06/01/2017 12:31 PM, Joakim wrote:

 I will write up instructions on how to write an Android app
in D _on_
 your Android device
I hope it will be detailed enough for people who are very new to programming on the Android.
Yes, the goal is to document all the steps, like I do on the wiki for cross-compiling now, but more so because it's completely new to most and requires a few more steps than the official NDK/SDK. But the official NDK requires using or mimicking their build system and the SDK can be a bear to setup, as they give you a ton of stuff like an IDE and emulators, so this might actually be easier overall. On Thursday, 1 June 2017 at 21:54:59 UTC, Johan Engelen wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 [awesome text]
This is great stuff Joakim! It's very nice to see your detailed release notes, with links to the patches. Hope we can get much of that into LDC master soon.
There's not much left, the cross-compiler doesn't require any patches and the remaining tweaks to druntime/phobos are minimal. I'll get the last bits in, with the exception of that workaround in std.stdio for the regression specific to Android 5.0. On Friday, 2 June 2017 at 00:00:17 UTC, Laeeth Isharc wrote:
 Congratulations, Joakim!
 https://www.reddit.com/r/programming/comments/6eqv46/write_mixed_dc_android_apps_even_build_them/
 and news.ycombinator.com

 Looking forward to termux.
Thanks for publicizing it, looks like you've started a discussion on reddit.
Jun 02 2017
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 1 June 2017 at 19:45:17 UTC, Ali Çehreli wrote:
 Very exciting! :)

 On 06/01/2017 12:31 PM, Joakim wrote:

 I will write up instructions on how to write an Android app
in D _on_
 your Android device
I hope it will be detailed enough for people who are very new to programming on the Android. Ali
I've finally written up full instructions on building D apps for Android by using the linux cross-compiler or native Android compiler I provide: https://wiki.dlang.org/Build_D_for_Android The upcoming ldc 1.4 beta will be the first to include Android cross-compilation support for all supported host platforms, ie Windows, Mac, and linux, as all my Android patches have now been merged. I'll stop putting out my own cross-compiler builds, though I'll maintain the native ldc package in the Termux package repo, once that's accepted. If you want to build full OpenGLES GUI Android apps on your Android device, this wiki page shows you how to do that too. You too can be one of the elite few building mobile apps on your mobile device, and in D!
Aug 26 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 26 August 2017 at 09:59:33 UTC, Joakim wrote:
 On Thursday, 1 June 2017 at 19:45:17 UTC, Ali Çehreli wrote:
 Very exciting! :)

 On 06/01/2017 12:31 PM, Joakim wrote:

 I will write up instructions on how to write an Android app
in D _on_
 your Android device
I hope it will be detailed enough for people who are very new to programming on the Android. Ali
I've finally written up full instructions on building D apps for Android by using the linux cross-compiler or native Android compiler I provide: https://wiki.dlang.org/Build_D_for_Android The upcoming ldc 1.4 beta will be the first to include Android cross-compilation support for all supported host platforms, ie Windows, Mac, and linux, as all my Android patches have now been merged. I'll stop putting out my own cross-compiler builds, though I'll maintain the native ldc package in the Termux package repo, once that's accepted. If you want to build full OpenGLES GUI Android apps on your Android device, this wiki page shows you how to do that too. You too can be one of the elite few building mobile apps on your mobile device, and in D!
And there is now an ldc package in the Termux Android app, updated the wiki page to show how simple it is to install ldc on your Android device now: https://wiki.dlang.org/Build_D_for_Android#Native_compilation_2 Make sure to tell everyone you know how easy it is to write D on your Android smartphone or tablet now, just like the Go people have been enjoying: https://mobile.twitter.com/mattbostock/status/896923877711814657 The Termux twitter highlights those now happy about using Node, Clojure, or Scala on their Android phone, hopefully D is next: https://mobile.twitter.com/termux Next up, getting D working on 64-bit ARM devices, which I recently got access to. David has been working on it already, hope we can get that done by ldc 1.5: https://github.com/ldc-developers/ldc/issues/2153
Aug 30 2017
next sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Wednesday, 30 August 2017 at 07:09:05 UTC, Joakim wrote:
 On Saturday, 26 August 2017 at 09:59:33 UTC, Joakim wrote:
 On Thursday, 1 June 2017 at 19:45:17 UTC, Ali Çehreli wrote:
 [...]
I've finally written up full instructions on building D apps for Android by using the linux cross-compiler or native Android compiler I provide: https://wiki.dlang.org/Build_D_for_Android The upcoming ldc 1.4 beta will be the first to include Android cross-compilation support for all supported host platforms, ie Windows, Mac, and linux, as all my Android patches have now been merged. I'll stop putting out my own cross-compiler builds, though I'll maintain the native ldc package in the Termux package repo, once that's accepted. If you want to build full OpenGLES GUI Android apps on your Android device, this wiki page shows you how to do that too. You too can be one of the elite few building mobile apps on your mobile device, and in D!
And there is now an ldc package in the Termux Android app, updated the wiki page to show how simple it is to install ldc on your Android device now: https://wiki.dlang.org/Build_D_for_Android#Native_compilation_2 Make sure to tell everyone you know how easy it is to write D on your Android smartphone or tablet now, just like the Go people have been enjoying: https://mobile.twitter.com/mattbostock/status/896923877711814657 The Termux twitter highlights those now happy about using Node, Clojure, or Scala on their Android phone, hopefully D is next: https://mobile.twitter.com/termux Next up, getting D working on 64-bit ARM devices, which I recently got access to. David has been working on it already, hope we can get that done by ldc 1.5: https://github.com/ldc-developers/ldc/issues/2153
rdmd and dub are now bundled with the native ldc package for Termux, so you can easily write small scripts in D on your phone or build and run tools like DScanner from the D package repository at code.dlang.org. For example, here's how you install ldc and run DScanner on your codebase to count how many lines of D code it has, all on your smartphone or tablet: apt install ldc dub fetch dscanner dub run dscanner -- -l your-code/
Sep 08 2017
next sibling parent kinke <noone nowhere.com> writes:
On Friday, 8 September 2017 at 11:52:48 UTC, Joakim wrote:
 For example, here's how you install ldc and run DScanner on 
 your codebase to count how many lines of D code it has, all on 
 your smartphone or tablet:

 apt install ldc

 dub fetch dscanner

 dub run dscanner -- -l your-code/
Very nice.
Sep 08 2017
prev sibling parent thinwybk <thinwybk mailbox.org> writes:
On Friday, 8 September 2017 at 11:52:48 UTC, Joakim wrote:
 rdmd and dub are now bundled with the native ldc package for 
 Termux, so you can easily write small scripts in D on your 
 phone or build and run tools like DScanner from the D package 
 repository at code.dlang.org.
Cool: pkg search ldc pkg install ldc plk install vim vim app.d import std.stdio; void main() { writeln("hello d on termux"); } (volume button up+q) (ESC button) :w :q ldc2 app.d ./app hello d on termux
Sep 10 2017
prev sibling next sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Wednesday, 30 August 2017 at 07:09:05 UTC, Joakim wrote:
[...]
 Next up, getting D working on 64-bit ARM devices, which I 
 recently got access to.  David has been working on it already, 
 hope we can get that done by ldc 1.5:

 https://github.com/ldc-developers/ldc/issues/2153
64-bit would be cool! I just connected a normal usb keyboard to my phone, and it already feels like being at home, only D is missing... :D
Sep 14 2017
prev sibling parent Joakim <dlang joakim.fea.st> writes:
On Wednesday, 30 August 2017 at 07:09:05 UTC, Joakim wrote:
 On Saturday, 26 August 2017 at 09:59:33 UTC, Joakim wrote:
 On Thursday, 1 June 2017 at 19:45:17 UTC, Ali Çehreli wrote:
 Very exciting! :)

 On 06/01/2017 12:31 PM, Joakim wrote:

 I will write up instructions on how to write an Android app
in D _on_
 your Android device
I hope it will be detailed enough for people who are very new to programming on the Android. Ali
I've finally written up full instructions on building D apps for Android by using the linux cross-compiler or native Android compiler I provide: https://wiki.dlang.org/Build_D_for_Android The upcoming ldc 1.4 beta will be the first to include Android cross-compilation support for all supported host platforms, ie Windows, Mac, and linux, as all my Android patches have now been merged. I'll stop putting out my own cross-compiler builds, though I'll maintain the native ldc package in the Termux package repo, once that's accepted. If you want to build full OpenGLES GUI Android apps on your Android device, this wiki page shows you how to do that too. You too can be one of the elite few building mobile apps on your mobile device, and in D!
And there is now an ldc package in the Termux Android app, updated the wiki page to show how simple it is to install ldc on your Android device now: https://wiki.dlang.org/Build_D_for_Android#Native_compilation_2 Make sure to tell everyone you know how easy it is to write D on your Android smartphone or tablet now, just like the Go people have been enjoying: https://mobile.twitter.com/mattbostock/status/896923877711814657 The Termux twitter highlights those now happy about using Node, Clojure, or Scala on their Android phone, hopefully D is next: https://mobile.twitter.com/termux Next up, getting D working on 64-bit ARM devices, which I recently got access to. David has been working on it already, hope we can get that done by ldc 1.5: https://github.com/ldc-developers/ldc/issues/2153
I've updated the wiki page with instructions for cross-compiling from macOS: https://wiki.dlang.org/Build_D_for_Android#Mac I forgot to mention in here that I added instructions for Windows six months back. I'm looking at 64-bit AArch64 support, where pretty much all the druntime tests pass with ldc 1.8 because of the great work of David, Kai, and others. The few failures are likely related to emulated TLS not being tied into the GC yet. I'll be working on this port this week.
Mar 18 2018
prev sibling next sibling parent Johan Engelen <j j.nl> writes:
On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 [awesome text]
This is great stuff Joakim! It's very nice to see your detailed release notes, with links to the patches. Hope we can get much of that into LDC master soon. Cheers, Johan
Jun 01 2017
prev sibling next sibling parent reply Laeeth Isharc <laeethnospam nospam.laeeth.com> writes:
On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is now 
 out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the Android 
 NDK, ported from C++ to about 1.2 klocs of D: the classic Utah 
 Teapot (https://en.wikipedia.org/wiki/Utah_teapot), updated 
 with mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of it 
 is written in D.

 There are two builds of ldc, a cross-compiler that you can use 
 from a linux/x64 shell to compile to Android/ARM, and a native 
 compiler that you can run on your Android device itself.  As I 
 pointed out last year, not only is ldc a large mixed D/C++ 
 codebase that just worked on ARM, but it is possible to build 
 arbitrarily large Android apps on your Android device itself, a 
 first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few languages 
 that is already there.

 I will write up instructions on how to write an Android app in 
 D _on_ your Android device by using ldc and the Termux app, and 
 get ldc into the Termux packages, a package repository for 
 Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Congratulations, Joakim! https://www.reddit.com/r/programming/comments/6eqv46/write_mixed_dc_android_apps_even_build_them/ and news.ycombinator.com Looking forward to termux.
Jun 01 2017
parent Joakim <dlang joakim.fea.st> writes:
On Friday, 2 June 2017 at 00:00:17 UTC, Laeeth Isharc wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 [...]
Congratulations, Joakim! https://www.reddit.com/r/programming/comments/6eqv46/write_mixed_dc_android_apps_even_build_them/ and news.ycombinator.com Looking forward to termux.
Haha, I lol'ed when I just read this comment: "Ah, D only came into my field of view with the recent support on Android and I assumed it was a recent language designed for Android." https://www.reddit.com/r/programming/comments/6eqv46/comment/dif3sa0 Well, at least we're getting more of these Android people introduced to D.
Jun 04 2017
prev sibling next sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 It is accompanied by a non-trivial sample app from the Android 
 NDK, ported from C++ to about 1.2 klocs of D: the classic Utah 
 Teapot (https://en.wikipedia.org/wiki/Utah_teapot), updated 
 with mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of it 
 is written in D.
Fantastic news, congrats!
Jun 01 2017
prev sibling next sibling parent reply =?UTF-8?B?RHXFoWFu?= Pavkov <dusan e-dule.com> writes:
On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is now 
 out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the Android 
 NDK, ported from C++ to about 1.2 klocs of D: the classic Utah 
 Teapot (https://en.wikipedia.org/wiki/Utah_teapot), updated 
 with mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of it 
 is written in D.

 There are two builds of ldc, a cross-compiler that you can use 
 from a linux/x64 shell to compile to Android/ARM, and a native 
 compiler that you can run on your Android device itself.  As I 
 pointed out last year, not only is ldc a large mixed D/C++ 
 codebase that just worked on ARM, but it is possible to build 
 arbitrarily large Android apps on your Android device itself, a 
 first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few languages 
 that is already there.

 I will write up instructions on how to write an Android app in 
 D _on_ your Android device by using ldc and the Termux app, and 
 get ldc into the Termux packages, a package repository for 
 Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Hello, Thanks for the post. I have tried to run apk on 2 devices: 1. LG-E440 phone with Android 4.1.2 2. Orange Pi Lite (development board with Allwinner H3 CPU) Android 4.4.2 On both devices there was only gray rectangle with "Teapot" notification at the bottom for about a sec and then in upper left corner the FPS info (around 60 on both devices), but without any graphic. I have tried taping, dragging etc. Are Android versions a problem or it could be something else? Thanks in advance.
Jun 02 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Friday, 2 June 2017 at 08:36:49 UTC, Dušan Pavkov wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is now 
 out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the Android 
 NDK, ported from C++ to about 1.2 klocs of D: the classic Utah 
 Teapot (https://en.wikipedia.org/wiki/Utah_teapot), updated 
 with mobile touch controls.  This app also demonstrates 
 calling Java functions from your D code through JNI, though 
 most of it is written in D.

 There are two builds of ldc, a cross-compiler that you can use 
 from a linux/x64 shell to compile to Android/ARM, and a native 
 compiler that you can run on your Android device itself.  As I 
 pointed out last year, not only is ldc a large mixed D/C++ 
 codebase that just worked on ARM, but it is possible to build 
 arbitrarily large Android apps on your Android device itself, 
 a first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few languages 
 that is already there.

 I will write up instructions on how to write an Android app in 
 D _on_ your Android device by using ldc and the Termux app, 
 and get ldc into the Termux packages, a package repository for 
 Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Hello, Thanks for the post. I have tried to run apk on 2 devices: 1. LG-E440 phone with Android 4.1.2 2. Orange Pi Lite (development board with Allwinner H3 CPU) Android 4.4.2 On both devices there was only gray rectangle with "Teapot" notification at the bottom for about a sec and then in upper left corner the FPS info (around 60 on both devices), but without any graphic. I have tried taping, dragging etc. Are Android versions a problem or it could be something else? Thanks in advance.
I'd guess that's the issue, as I haven't tested against those older versions of Android and this app links against Android API 21, ie 5.0 Lollipop: https://github.com/joakim-noah/android/blob/master/samples/Teapot/build-apk#L17 I'm pretty sure it'd work for your older Android versions if built slightly differently, as I used to support back to Android API 9 until a couple months ago: https://gist.github.com/joakim-noah/f475b0be37b3834b4e50d68996b6ee1d#file-ldc_1-1-0_android_arm-L3438 It can be still made to so but I set API 21 as the minimum, because anything older has been declining for some time now: http://blog.davidecoppola.com/2016/12/android-version-distribution-history-visualization-2012-2016/
Jun 02 2017
next sibling parent reply Petar Kirov [ZombineDev] <petar.p.kirov gmail.com> writes:
On Friday, 2 June 2017 at 08:58:01 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 08:36:49 UTC, Dušan Pavkov wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is 
 now out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the 
 Android NDK, ported from C++ to about 1.2 klocs of D: the 
 classic Utah Teapot 
 (https://en.wikipedia.org/wiki/Utah_teapot), updated with 
 mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of 
 it is written in D.

 There are two builds of ldc, a cross-compiler that you can 
 use from a linux/x64 shell to compile to Android/ARM, and a 
 native compiler that you can run on your Android device 
 itself.  As I pointed out last year, not only is ldc a large 
 mixed D/C++ codebase that just worked on ARM, but it is 
 possible to build arbitrarily large Android apps on your 
 Android device itself, a first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few languages 
 that is already there.

 I will write up instructions on how to write an Android app 
 in D _on_ your Android device by using ldc and the Termux 
 app, and get ldc into the Termux packages, a package 
 repository for Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Hello, Thanks for the post. I have tried to run apk on 2 devices: 1. LG-E440 phone with Android 4.1.2 2. Orange Pi Lite (development board with Allwinner H3 CPU) Android 4.4.2 On both devices there was only gray rectangle with "Teapot" notification at the bottom for about a sec and then in upper left corner the FPS info (around 60 on both devices), but without any graphic. I have tried taping, dragging etc. Are Android versions a problem or it could be something else? Thanks in advance.
I'd guess that's the issue, as I haven't tested against those older versions of Android and this app links against Android API 21, ie 5.0 Lollipop: https://github.com/joakim-noah/android/blob/master/samples/Teapot/build-apk#L17 I'm pretty sure it'd work for your older Android versions if built slightly differently, as I used to support back to Android API 9 until a couple months ago: https://gist.github.com/joakim-noah/f475b0be37b3834b4e50d68996b6ee1d#file-ldc_1-1-0_android_arm-L3438 It can be still made to so but I set API 21 as the minimum, because anything older has been declining for some time now: http://blog.davidecoppola.com/2016/12/android-version-distribution-history-visualization-2012-2016/
Just FYI, I have the same issue with Android 6.0.1.
Jun 02 2017
parent reply Joakim <dlang joakim.fea.st> writes:
On Friday, 2 June 2017 at 09:39:46 UTC, Petar Kirov [ZombineDev] 
wrote:
 On Friday, 2 June 2017 at 08:58:01 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 08:36:49 UTC, Dušan Pavkov wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is 
 now out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the 
 Android NDK, ported from C++ to about 1.2 klocs of D: the 
 classic Utah Teapot 
 (https://en.wikipedia.org/wiki/Utah_teapot), updated with 
 mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of 
 it is written in D.

 There are two builds of ldc, a cross-compiler that you can 
 use from a linux/x64 shell to compile to Android/ARM, and a 
 native compiler that you can run on your Android device 
 itself.  As I pointed out last year, not only is ldc a large 
 mixed D/C++ codebase that just worked on ARM, but it is 
 possible to build arbitrarily large Android apps on your 
 Android device itself, a first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few 
 languages that is already there.

 I will write up instructions on how to write an Android app 
 in D _on_ your Android device by using ldc and the Termux 
 app, and get ldc into the Termux packages, a package 
 repository for Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Hello, Thanks for the post. I have tried to run apk on 2 devices: 1. LG-E440 phone with Android 4.1.2 2. Orange Pi Lite (development board with Allwinner H3 CPU) Android 4.4.2 On both devices there was only gray rectangle with "Teapot" notification at the bottom for about a sec and then in upper left corner the FPS info (around 60 on both devices), but without any graphic. I have tried taping, dragging etc. Are Android versions a problem or it could be something else? Thanks in advance.
I'd guess that's the issue, as I haven't tested against those older versions of Android and this app links against Android API 21, ie 5.0 Lollipop: https://github.com/joakim-noah/android/blob/master/samples/Teapot/build-apk#L17 I'm pretty sure it'd work for your older Android versions if built slightly differently, as I used to support back to Android API 9 until a couple months ago: https://gist.github.com/joakim-noah/f475b0be37b3834b4e50d68996b6ee1d#file-ldc_1-1-0_android_arm-L3438 It can be still made to so but I set API 21 as the minimum, because anything older has been declining for some time now: http://blog.davidecoppola.com/2016/12/android-version-distribution-history-visualization-2012-2016/
Just FYI, I have the same issue with Android 6.0.1.
Hmm, is that the 64-bit Xiaomi device you mentioned in the github issues just now? My guess there would be that it's because ldc only supports 32-bit Android/ARM devices right now, and 64-bit devices like Xiaomi probably don't run 32-bit native Android libraries in their apps, though I don't know that for sure. I just tried installing the teapot app on another 32-bit 6.0.1 phone that I'd never tried before, worked fine. This is not an issue for Java, because the Android runtime compiles Java bytecode to native code _after_ the app is downloaded, but other languages have to provide pre-compiled libraries for each CPU architecture. Not a big deal as there are only really two in wide deployment, 32-bit and 64-bit ARM, with the vast majority 32-bit right now. Perhaps you can help us get on 64-bit ARM, as you mentioned in the github issues.
Jun 02 2017
next sibling parent reply Petar Kirov [ZombineDev] <petar.p.kirov gmail.com> writes:
On Friday, 2 June 2017 at 10:12:27 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 09:39:46 UTC, Petar Kirov 
 [ZombineDev] wrote:
 On Friday, 2 June 2017 at 08:58:01 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 08:36:49 UTC, Dušan Pavkov wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is 
 now out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the 
 Android NDK, ported from C++ to about 1.2 klocs of D: the 
 classic Utah Teapot 
 (https://en.wikipedia.org/wiki/Utah_teapot), updated with 
 mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of 
 it is written in D.

 There are two builds of ldc, a cross-compiler that you can 
 use from a linux/x64 shell to compile to Android/ARM, and a 
 native compiler that you can run on your Android device 
 itself.  As I pointed out last year, not only is ldc a 
 large mixed D/C++ codebase that just worked on ARM, but it 
 is possible to build arbitrarily large Android apps on your 
 Android device itself, a first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few 
 languages that is already there.

 I will write up instructions on how to write an Android app 
 in D _on_ your Android device by using ldc and the Termux 
 app, and get ldc into the Termux packages, a package 
 repository for Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Hello, Thanks for the post. I have tried to run apk on 2 devices: 1. LG-E440 phone with Android 4.1.2 2. Orange Pi Lite (development board with Allwinner H3 CPU) Android 4.4.2 On both devices there was only gray rectangle with "Teapot" notification at the bottom for about a sec and then in upper left corner the FPS info (around 60 on both devices), but without any graphic. I have tried taping, dragging etc. Are Android versions a problem or it could be something else? Thanks in advance.
I'd guess that's the issue, as I haven't tested against those older versions of Android and this app links against Android API 21, ie 5.0 Lollipop: https://github.com/joakim-noah/android/blob/master/samples/Teapot/build-apk#L17 I'm pretty sure it'd work for your older Android versions if built slightly differently, as I used to support back to Android API 9 until a couple months ago: https://gist.github.com/joakim-noah/f475b0be37b3834b4e50d68996b6ee1d#file-ldc_1-1-0_android_arm-L3438 It can be still made to so but I set API 21 as the minimum, because anything older has been declining for some time now: http://blog.davidecoppola.com/2016/12/android-version-distribution-history-visualization-2012-2016/
Just FYI, I have the same issue with Android 6.0.1.
Hmm, is that the 64-bit Xiaomi device you mentioned in the github issues just now?
Yep
 My guess there would be that it's because ldc only supports 
 32-bit Android/ARM devices right now, and 64-bit devices like 
 Xiaomi probably don't run 32-bit native Android libraries in 
 their apps, though I don't know that for sure.  I just tried 
 installing the teapot app on another 32-bit 6.0.1 phone that 
 I'd never tried before, worked fine.
Running 32-bit apps on 64-bit Android, shouldn't be an issue as far I know. See: https://stackoverflow.com/questions/30782848/how-to-use-32-bit-native-libraries-on-64-bit-android-device
 This is not an issue for Java, because the Android runtime 
 compiles Java bytecode to native code _after_ the app is 
 downloaded, but other languages have to provide pre-compiled 
 libraries for each CPU architecture.  Not a big deal as there 
 are only really two in wide deployment, 32-bit and 64-bit ARM, 
 with the vast majority 32-bit right now.

 Perhaps you can help us get on 64-bit ARM, as you mentioned in 
 the github issues.
Yes, ultimately I'm interested in writing a Vulkan library that runs on both 32 and 64-bit Linux, Windows and Android, so I'm interested in helping with the AArch64 support too, though my compiler-foo is pretty slim. As mentioned in the GH issue [0], what do I need to bootstrap LDC on Android? [0]: https://github.com/joakim-noah/android/issues/10
Jun 02 2017
parent Joakim <dlang joakim.fea.st> writes:
On Friday, 2 June 2017 at 10:40:48 UTC, Petar Kirov [ZombineDev] 
wrote:
 On Friday, 2 June 2017 at 10:12:27 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 09:39:46 UTC, Petar Kirov 
 [ZombineDev] wrote:
 On Friday, 2 June 2017 at 08:58:01 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 08:36:49 UTC, Dušan Pavkov wrote:
 [...]
I'd guess that's the issue, as I haven't tested against those older versions of Android and this app links against Android API 21, ie 5.0 Lollipop: https://github.com/joakim-noah/android/blob/master/samples/Teapot/build-apk#L17 I'm pretty sure it'd work for your older Android versions if built slightly differently, as I used to support back to Android API 9 until a couple months ago: https://gist.github.com/joakim-noah/f475b0be37b3834b4e50d68996b6ee1d#file-ldc_1-1-0_android_arm-L3438 It can be still made to so but I set API 21 as the minimum, because anything older has been declining for some time now: http://blog.davidecoppola.com/2016/12/android-version-distribution-history-visualization-2012-2016/
Just FYI, I have the same issue with Android 6.0.1.
Hmm, is that the 64-bit Xiaomi device you mentioned in the github issues just now?
Yep
 My guess there would be that it's because ldc only supports 
 32-bit Android/ARM devices right now, and 64-bit devices like 
 Xiaomi probably don't run 32-bit native Android libraries in 
 their apps, though I don't know that for sure.  I just tried 
 installing the teapot app on another 32-bit 6.0.1 phone that 
 I'd never tried before, worked fine.
Running 32-bit apps on 64-bit Android, shouldn't be an issue as far I know. See: https://stackoverflow.com/questions/30782848/how-to-use-32-bit-native-libraries-on-64-bit-android-device
64-bit ARMv8 hardware should run 32-bit ARMv7 binaries, but it depends on software support too, like providing the 32-bit system shared libraries that this 32-bit teapot shared library links against. I found that SO link inconclusive, but I just found this blog post from a couple years ago that says that it depends on the device: https://ph0b.com/android-abis-and-so-files/ With your 64-bit device, either it doesn't list ARMv7 as a supported ABI or there's some bug that's stopping it from running this 32-bit ARMv7 library on ARMv8.
 This is not an issue for Java, because the Android runtime 
 compiles Java bytecode to native code _after_ the app is 
 downloaded, but other languages have to provide pre-compiled 
 libraries for each CPU architecture.  Not a big deal as there 
 are only really two in wide deployment, 32-bit and 64-bit ARM, 
 with the vast majority 32-bit right now.

 Perhaps you can help us get on 64-bit ARM, as you mentioned in 
 the github issues.
Yes, ultimately I'm interested in writing a Vulkan library that runs on both 32 and 64-bit Linux, Windows and Android, so I'm interested in helping with the AArch64 support too, though my compiler-foo is pretty slim. As mentioned in the GH issue [0], what do I need to bootstrap LDC on Android? [0]: https://github.com/joakim-noah/android/issues/10
I've followed up on github, we can discuss there.
Jun 02 2017
prev sibling parent vondes <vondes yahoo.com> writes:
So, how its app can work with mobile recorder 
https://mobilerecorder24.com/ on Android?
Jun 19 2017
prev sibling parent Joakim <dlang joakim.fea.st> writes:
On Friday, 2 June 2017 at 08:58:01 UTC, Joakim wrote:
 On Friday, 2 June 2017 at 08:36:49 UTC, Dušan Pavkov wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is 
 now out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the 
 Android NDK, ported from C++ to about 1.2 klocs of D: the 
 classic Utah Teapot 
 (https://en.wikipedia.org/wiki/Utah_teapot), updated with 
 mobile touch controls.  This app also demonstrates calling 
 Java functions from your D code through JNI, though most of 
 it is written in D.

 There are two builds of ldc, a cross-compiler that you can 
 use from a linux/x64 shell to compile to Android/ARM, and a 
 native compiler that you can run on your Android device 
 itself.  As I pointed out last year, not only is ldc a large 
 mixed D/C++ codebase that just worked on ARM, but it is 
 possible to build arbitrarily large Android apps on your 
 Android device itself, a first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into 
 coding, by tinkering with their Android devices like we did 
 with Macs and PCs decades ago, and D is one the few languages 
 that is already there.

 I will write up instructions on how to write an Android app 
 in D _on_ your Android device by using ldc and the Termux 
 app, and get ldc into the Termux packages, a package 
 repository for Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Hello, Thanks for the post. I have tried to run apk on 2 devices: 1. LG-E440 phone with Android 4.1.2 2. Orange Pi Lite (development board with Allwinner H3 CPU) Android 4.4.2 On both devices there was only gray rectangle with "Teapot" notification at the bottom for about a sec and then in upper left corner the FPS info (around 60 on both devices), but without any graphic. I have tried taping, dragging etc. Are Android versions a problem or it could be something else? Thanks in advance.
I'd guess that's the issue, as I haven't tested against those older versions of Android and this app links against Android API 21, ie 5.0 Lollipop: https://github.com/joakim-noah/android/blob/master/samples/Teapot/build-apk#L17 I'm pretty sure it'd work for your older Android versions if built slightly differently, as I used to support back to Android API 9 until a couple months ago: https://gist.github.com/joakim-noah/f475b0be37b3834b4e50d68996b6ee1d#file-ldc_1-1-0_android_arm-L3438 It can be still made to so but I set API 21 as the minimum, because anything older has been declining for some time now: http://blog.davidecoppola.com/2016/12/android-version-distribution-history-visualization-2012-2016/
I investigated this a little, as I remembered that I have an old Android 4.4 Kitkat tablet lying around. I am able to reproduce the grey screen, with no teapot. I tried recompiling and linking the native D portion of the app against API 9, but noticed that the resulting native D library was exactly the same, with the same SHA hash. Then I remembered that I built the small Java portion of the app against API 21 also. My guess is that is what is causing the problem, since the Java source has to do a bit of setup so that both the Java and D code can share the UI: https://github.com/joakim-noah/android/blob/master/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java This is needed because this sample app demonstrates using JNI to call the Java functions showUI and updateFPS, to send the framerate from D to the Java functions to display at the top left. I will note the Android 5.0 requirement on the release, thanks for reporting.
Jun 02 2017
prev sibling next sibling parent Jonathan M Davis via Digitalmars-d-announce writes:
On Thursday, June 01, 2017 19:31:28 Joakim via Digitalmars-d-announce wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is now
 out:

 https://github.com/joakim-noah/android/releases

 It is accompanied by a non-trivial sample app from the Android
 NDK, ported from C++ to about 1.2 klocs of D: the classic Utah
 Teapot (https://en.wikipedia.org/wiki/Utah_teapot), updated with
 mobile touch controls.  This app also demonstrates calling Java
 functions from your D code through JNI, though most of it is
 written in D.

 There are two builds of ldc, a cross-compiler that you can use
 from a linux/x64 shell to compile to Android/ARM, and a native
 compiler that you can run on your Android device itself.  As I
 pointed out last year, not only is ldc a large mixed D/C++
 codebase that just worked on ARM, but it is possible to build
 arbitrarily large Android apps on your Android device itself, a
 first for any mobile platform:

 http://forum.dlang.org/thread/ovkhtsdzlfzqrqneolyv forum.dlang.org

 This is the way the next generation of coders will get into
 coding, by tinkering with their Android devices like we did with
 Macs and PCs decades ago, and D is one the few languages that is
 already there.

 I will write up instructions on how to write an Android app in D
 _on_ your Android device by using ldc and the Termux app, and get
 ldc into the Termux packages, a package repository for Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
Yay! I keep meaning to check out programming for Android, but as with far too many things, I never get around to it. But if I program for something like Android, I'd definitely prefer to be doing it in D. A huge thanks to you and everyone else who's worked on this! - Jonathan M Davis
Jun 02 2017
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
 The beta release of ldc 1.3, the llvm-based D compiler, is now 
 out:

 https://github.com/joakim-noah/android/releases
---snip---
 I will write up instructions on how to write an Android app in 
 D _on_ your Android device by using ldc and the Termux app, and 
 get ldc into the Termux packages, a package repository for 
 Android:

 https://play.google.com/store/apps/details?id=com.termux&hl=en
I've now put up a deb file at the first release link above that you can install in the Termux app, the result of this PR to get ldc into the Termux package repository for Android: https://github.com/termux/termux-packages/pull/1078 Try the deb file out by installing the Termux app, then running the following commands: apt install clang curl curl -L -O https://github.com/joakim-noah/android/releases/download/tea/ldc_1.3.0_arm.deb dpkg -i ldc ldc2 --version Once ldc gets into the Termux package repository, all you'll need to run is "apt install ldc". Finally, try to build your favorite D file: ldc2 sieve.d
Jun 10 2017
parent Joakim <dlang joakim.fea.st> writes:
On Sunday, 11 June 2017 at 04:15:13 UTC, Joakim wrote:
 On Thursday, 1 June 2017 at 19:31:28 UTC, Joakim wrote:
[...]
---snip---
 [...]
I've now put up a deb file at the first release link above that you can install in the Termux app, the result of this PR to get ldc into the Termux package repository for Android: https://github.com/termux/termux-packages/pull/1078 Try the deb file out by installing the Termux app, then running the following commands: apt install clang curl curl -L -O https://github.com/joakim-noah/android/releases/download/tea/ldc_1.3.0_arm.deb dpkg -i ldc ldc2 --version Once ldc gets into the Termux package repository, all you'll need to run is "apt install ldc". Finally, try to build your favorite D file: ldc2 sieve.d
Sorry, that should be: dpkg -i ldc_1.3.0_arm.deb
Jun 11 2017