www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - DlangUI on Android

reply Vadim Lopatin <coolreader.org gmail.com> writes:
Hello,

I've implemented initial support of Android in DlangUI.

Only armv7a architecture is supported so far.

You can downlowd sample APK: 
https://sourceforge.net/projects/crengine/files/DlangUI/


How to add support of Android to your DlangUI project.
=====================================================

Copy dlangui/android/android_project directory to you DlangUI 
project directory.


Probably you will want to change android package name in 
AndroidManifest.xml and application display name in 
res/values/strings.xml


Modify android_app.mk, android_build_config.mk

android_app.mk
==============

Update LOCAL_SRC_FILES to include all your project's files.


android_build_config.mk
=======================

Update paths to Android NDK, SDK, DlangUI source directory.

Default values:
export DLANGUI_DIR=$HOME/src/d/dlangui
export NDK=$HOME/android-ndk-r11c
export SDK=$HOME/android-sdk-linux
export LDC=$HOME/ldc2-android-arm-0.17.0-alpha2-linux-x86_64
export NDK_ARCH=x86_64


Use LDC cross compiler for armv7a build according instructions

https://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D
Apr 21 2016
next sibling parent reply ANtlord <antlord92 gmail.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 Hello,

 I've implemented initial support of Android in DlangUI.
Am I sleeping? Can we develop UI applications for Android on D? It's great!
Apr 21 2016
next sibling parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Thursday, 21 April 2016 at 14:48:40 UTC, ANtlord wrote:
 On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 Hello,

 I've implemented initial support of Android in DlangUI.
Am I sleeping? Can we develop UI applications for Android on D? It's great!
Yes, and the same code may run on both desktops and Android.
Apr 21 2016
prev sibling parent reply David Nadlinger <code klickverbot.at> writes:
On Thursday, 21 April 2016 at 14:48:40 UTC, ANtlord wrote:
 Am I sleeping? Can we develop UI applications for Android on D? 
 It's great!
Yes – cool, right? This is a reality now mostly due to Joakim's great LDC work. — David
Apr 22 2016
next sibling parent David Nadlinger <code klickverbot.at> writes:
On Friday, 22 April 2016 at 18:48:26 UTC, David Nadlinger wrote:
 This is a reality now mostly due to Joakim's great LDC work.
(the fact that we can deploy stuff to Android in the first place, that is – obviously, the UI layer is a whole separate story)
Apr 22 2016
prev sibling parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Friday, 22 April 2016 at 18:48:26 UTC, David Nadlinger wrote:
 This is a reality now mostly due to Joakim's great LDC work.
Yes, it's really GREAT work! I just took his NativeActivity example and modified a bit to make dlangui's platform class implementation. I would be nice to have all Joakim's patches in upstream LDC and druntime/phobos.
Apr 22 2016
prev sibling next sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 Hello,

 I've implemented initial support of Android in DlangUI.
Forgot to add that DerelictFT patch is required for DlangUI/Android. (Freetype library has name libft2.so on Android) PR is submitted, but not yet integrated into DerelictFT: https://github.com/DerelictOrg/DerelictFT/pull/9 PS: Current build is using android-19 API (Android 4.4 Kitkat) due to GLES3 dependency. Will provide support of older platforms later, if needed.
Apr 21 2016
parent reply Mike Parker <aldacron gmail.com> writes:
On Thursday, 21 April 2016 at 15:49:32 UTC, Vadim Lopatin wrote:

 Forgot to add that DerelictFT patch is required for 
 DlangUI/Android.
 (Freetype library has name libft2.so on Android)

 PR is submitted, but not yet integrated into DerelictFT:

 https://github.com/DerelictOrg/DerelictFT/pull/9
I was late, but I have since gotten this taken care of, so it's all golden. FYI, for anyone facing a similar problem in the future and is hung up waiting on me to merge a pull request, the base loader in DerelictUtil allows overriding the default library names. So instead of a library like DLangUI requiring a patched Derelict package, you could do this: version(Derelict_OS_Android) DerelictFT.load("libft2.so"); You can pass multiple library names as a single, comma-separated string: DerelictFT.load("libft2.so,libfreetype.so"); Or as an array (which is what the above is converted to internally anyway): DerelictFT.load(["libft2.so", "libfreetype.so"]);
Apr 22 2016
parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Friday, 22 April 2016 at 13:41:52 UTC, Mike Parker wrote:
 I was late, but I have since gotten this taken care of, so it's 
 all golden.

 FYI, for anyone facing a similar problem in the future and is 
 hung up waiting on me to merge a pull request, the base loader 
 in DerelictUtil allows overriding the default library names. So 
 instead of a library like DLangUI requiring a patched Derelict 
 package, you could do this:

 version(Derelict_OS_Android)
     DerelictFT.load("libft2.so");

 You can pass multiple library names as a single, 
 comma-separated string:

 DerelictFT.load("libft2.so,libfreetype.so");

 Or as an array (which is what the above is converted to 
 internally anyway):

 DerelictFT.load(["libft2.so", "libfreetype.so"]);
Thank you for your help! I've updated dlangui dub.json with latest DerelictFT.
Apr 22 2016
prev sibling next sibling parent Dmitry <dmitry indiedev.ru> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 I've implemented initial support of Android in DlangUI.
It's great! Thank you! And congrats with it!
Apr 21 2016
prev sibling next sibling parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 Hello,

 I've implemented initial support of Android in DlangUI.

 Only armv7a architecture is supported so far.

 You can downlowd sample APK: 
 https://sourceforge.net/projects/crengine/files/DlangUI/
DlangUI Tetris example now works ok on Android (arm, android4.4+) You can download it here: https://sourceforge.net/projects/crengine/files/DlangUI/
Apr 22 2016
parent reply FrankLike <1150015857 qq.com> writes:
On Friday, 22 April 2016 at 12:05:52 UTC, Vadim Lopatin wrote:
 On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 Hello,

 I've implemented initial support of Android in DlangUI.

 Only armv7a architecture is supported so far.

 You can downlowd sample APK: 
 https://sourceforge.net/projects/crengine/files/DlangUI/
DlangUI Tetris example now works ok on Android (arm, android4.4+)
Android5.02 ,Not ok, sorry.
Apr 22 2016
parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Friday, 22 April 2016 at 15:02:32 UTC, FrankLike wrote:
 You can downlowd sample APK: 
 https://sourceforge.net/projects/crengine/files/DlangUI/
DlangUI Tetris example now works ok on Android (arm, android4.4+)
Android5.02 ,Not ok, sorry.
Does it crash instantly or shows app GUI for some time? Is your smartphone arm-based? Couldn't you collect logs with `adb logcat`?
Apr 22 2016
next sibling parent FrankLike <1150015857 qq.com> writes:
On Friday, 22 April 2016 at 17:02:20 UTC, Vadim Lopatin wrote:
 On Friday, 22 April 2016 at 15:02:32 UTC, FrankLike wrote:
 You can downlowd sample APK: 
 https://sourceforge.net/projects/crengine/files/DlangUI/
DlangUI Tetris example now works ok on Android (arm, android4.4+)
Android5.02 ,Not ok, sorry.
Does it crash instantly or shows app GUI for some time? Is your smartphone arm-based? Couldn't you collect logs with `adb logcat`?
What is the name of log file? Nothing is in SDCard.
Apr 23 2016
prev sibling parent reply FrankLike <1150015857 qq.com> writes:
On Friday, 22 April 2016 at 17:02:20 UTC, Vadim Lopatin wrote:

 Does it crash instantly or shows app GUI for some time?
 Is your smartphone arm-based?
test-runner.apk is ok,but DLangUITetrisExample.apk and DlangUIHelloWorld.apk ,only shows black color. HTC Android 5.02 ,it's arm-based,Not ok, sorry. Where is the log file? Path?
Apr 23 2016
parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Saturday, 23 April 2016 at 11:21:10 UTC, FrankLike wrote:
 On Friday, 22 April 2016 at 17:02:20 UTC, Vadim Lopatin wrote:

 Does it crash instantly or shows app GUI for some time?
 Is your smartphone arm-based?
test-runner.apk is ok,but DLangUITetrisExample.apk and DlangUIHelloWorld.apk ,only shows black color. HTC Android 5.02 ,it's arm-based,Not ok, sorry. Where is the log file? Path?
Log messages are in Android system log. On older androids, application CatLog (available on Market) was able to store logs to file. But on latest android, app cannot read logs of other applications, and CatLog shows none useful. You can try CatLog, but if it does not work (if you cannot see any messages with 'dlangui' tag), the only way to get logs I know is to use 'adb' utility from Android SDK. Download Android SDK, unpack to some folder, use sdk/platform-tools/adb utility. Connect device to pc using USB. `adb logcat` from commandline shows log messages from device. run `adb logcat > log.txt`, then start program which crashes on device, then press Ctrl+C to stop adb logcat. Now file log.txt should contain logs with crash.
Apr 23 2016
parent reply FrankLike <1150015857 qq.com> writes:
On Saturday, 23 April 2016 at 11:42:49 UTC, Vadim Lopatin wrote:
 [...]
Thank you. But why nothing to be shown,only black color?
Apr 23 2016
parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Saturday, 23 April 2016 at 12:45:01 UTC, FrankLike wrote:
 On Saturday, 23 April 2016 at 11:42:49 UTC, Vadim Lopatin wrote:
 [...]
Thank you. But why nothing to be shown,only black color?
Probably something is wrong with OpenGL. E.g. OpenGL ES3 is not supported. Log can should failed opengl calls.
Apr 23 2016
parent FrankLike <1150015857 qq.com> writes:
On Saturday, 23 April 2016 at 14:35:55 UTC, Vadim Lopatin wrote:
 On Saturday, 23 April 2016 at 12:45:01 UTC, FrankLike wrote:
 On Saturday, 23 April 2016 at 11:42:49 UTC, Vadim Lopatin 
 wrote:
 [...]
Thank you. But why nothing to be shown,only black color?
Probably something is wrong with OpenGL. E.g. OpenGL ES3 is not supported. Log can should failed opengl calls.
Waiting for the new apk.... Thank you..
Apr 23 2016
prev sibling next sibling parent FrankLike <1150015857 qq.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 Hello,

 I've implemented initial support of Android in DlangUI.

 [...]
Congratulations!
Apr 22 2016
prev sibling next sibling parent TheGag96 <thegag96 gmail.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 (snip)
Wow, really nice stuff! I wasn't even aware we could write D for Android at all...
Apr 22 2016
prev sibling next sibling parent reply Laeeth Isharc <laeethnospam nospam.laeeth.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 I've implemented initial support of Android in DlangUI.
Congratulations, Vadim. This is a very exciting development. (And impressive in the 'consequent' department, as the Germans say - you said you would have DlangUI ported to Android some weeks after the working compiler, and that's what you did!). Might be useful for me to port some D code for internal enterprise apps to Android that currently runs on linux (I recognise how experimental it is, but I'm okay with that since mobile is just nice to have, and not yet necessary). Will you be at dconf?
Apr 22 2016
parent reply Vadim Lopatin <coolreader.org gmail.com> writes:
On Friday, 22 April 2016 at 18:49:24 UTC, Laeeth Isharc wrote:
 This is a very exciting development.  (And impressive in the 
 'consequent' department, as the Germans say - you said you 
 would have DlangUI ported to Android some weeks after the 
 working compiler, and that's what you did!).
It took about one week to make DlangUI android backend once I managed to build NativeActivity example by Joakim's instructions. I would say it will take a week or too to make iOS backend once we have working compiler for iOS (in my estimations it will have 1K-2K lines of D code and 1K-2K lines of obj-c code. Unfortunately, I have no experience with objective C neither with iOS programming. Android port was easy for me because DlangUI was a kind of port/reimplementation of my C++ cross platform GUI library I used for my CoolReader GL project (e-book reader).
 Might be useful for me to port some D code for internal 
 enterprise apps to Android that currently runs on linux (I 
 recognise how experimental it is, but I'm okay with that since 
 mobile is just nice to have, and not yet necessary).
Please let me know issue you face when using DlangUI for mobile development.
 Will you be at dconf?
No, I'm not planning to participate. D is just a hobby for me.
Apr 22 2016
next sibling parent MrSmith <mrsmith33 yandex.ru> writes:
Works on Nexus 7, Android 6.0.1!
Apr 23 2016
prev sibling parent reply Chris <wendlec tcd.ie> writes:
On Saturday, 23 April 2016 at 02:48:10 UTC, Vadim Lopatin wrote:
 On Friday, 22 April 2016 at 18:49:24 UTC, Laeeth Isharc wrote:
 This is a very exciting development.  (And impressive in the 
 'consequent' department, as the Germans say - you said you 
 would have DlangUI ported to Android some weeks after the 
 working compiler, and that's what you did!).
It took about one week to make DlangUI android backend once I managed to build NativeActivity example by Joakim's instructions. I would say it will take a week or too to make iOS backend once we have working compiler for iOS (in my estimations it will have 1K-2K lines of D code and 1K-2K lines of obj-c code. Unfortunately, I have no experience with objective C neither with iOS programming. Android port was easy for me because DlangUI was a kind of port/reimplementation of my C++ cross platform GUI library I used for my CoolReader GL project (e-book reader).
 Might be useful for me to port some D code for internal 
 enterprise apps to Android that currently runs on linux (I 
 recognise how experimental it is, but I'm okay with that since 
 mobile is just nice to have, and not yet necessary).
Please let me know issue you face when using DlangUI for mobile development.
 Will you be at dconf?
No, I'm not planning to participate. D is just a hobby for me.
Anyone interested in taking DlangUI and turning it into something like Swing/JavaFX for D?
Apr 23 2016
parent reply thedeemon <dlang thedeemon.com> writes:
On Saturday, 23 April 2016 at 18:16:38 UTC, Chris wrote:

 Anyone interested in taking DlangUI and turning it into 
 something like Swing/JavaFX for D?
What exactly do you mean by that?
Apr 23 2016
parent reply Chris <wendlec tcd.ie> writes:
On Sunday, 24 April 2016 at 06:19:14 UTC, thedeemon wrote:
 On Saturday, 23 April 2016 at 18:16:38 UTC, Chris wrote:

 Anyone interested in taking DlangUI and turning it into 
 something like Swing/JavaFX for D?
What exactly do you mean by that?
Embrace DlangUI or something based on it in the same way DUB was embraced. Atm, only Vadim works on it as a hobby. It would be a pity to see it come to a standstill one day - for what ever reason. I think a D based UI is important, especially now that D is getting some attention.
Apr 24 2016
parent Karabuta <karabutaworld gmail.com> writes:
On Sunday, 24 April 2016 at 11:57:18 UTC, Chris wrote:
 On Sunday, 24 April 2016 at 06:19:14 UTC, thedeemon wrote:
 On Saturday, 23 April 2016 at 18:16:38 UTC, Chris wrote:

 Anyone interested in taking DlangUI and turning it into 
 something like Swing/JavaFX for D?
What exactly do you mean by that?
Embrace DlangUI or something based on it in the same way DUB was embraced. Atm, only Vadim works on it as a hobby. It would be a pity to see it come to a standstill one day - for what ever reason. I think a D based UI is important, especially now that D is getting some attention.
+1
Apr 25 2016
prev sibling parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Thursday, 21 April 2016 at 13:28:18 UTC, Vadim Lopatin wrote:
 You can download sample APK: 
 https://sourceforge.net/projects/crengine/files/DlangUI/
New example - Minecraft-like 3D application. It's demo of dlangui Scene3d - simple 3D engine. On Android works a bit slow, and with artifacts. But works... To try it on desktop, use `dub run dlangui:dminer` Another Scene3d example: `dub run dlangui:d3d`
Apr 26 2016