Dart on Android soon?

2,396 views
Skip to first unread message

Nelson Silva

unread,
May 8, 2013, 6:42:37 AM5/8/13
to mi...@dartlang.org
Hi all,

I've been following the ARM support stuff that has been added to Dart recently so I was wondering if we'll be getting Dart on Android any time soon ?

I've tried to make a couple of changes to build.py to get the cross platform build to target the arm arch using the prebuilt NDK packages but failed to get it working... any tips ?

Gen

unread,
May 8, 2013, 7:09:29 AM5/8/13
to mi...@dartlang.org
I do not know what you mean by Dart on Android.

But I would like to have something like phonegap as Dart library and a comfortable Android emulation in Dart and the Dart Editor.
 
My guess is that the Dart team prefers to support the HTML standard for the newest Chrome browser with Android specific extensions.
Instead of supporting native technologies in multiple versions using the native API (Java, Objective C).

kc

unread,
May 8, 2013, 11:19:24 AM5/8/13
to mi...@dartlang.org
On Wednesday, May 8, 2013 12:09:29 PM UTC+1, Gen wrote:
I do not know what you mean by Dart on Android.

But I would like to have something like phonegap as Dart library and a comfortable Android emulation in Dart and the Dart Editor.
 

I would like to create Android apks which include the DartVM and have access to the non-ui parts of the android platform re services, activities. And write cross platform 2d/3d code.
With HTML widgets that use the android platform theme.

K.

James Wendel

unread,
May 8, 2013, 11:29:18 AM5/8/13
to mi...@dartlang.org
I'm guessing that the DartVM Arm work is to get Dart working in Chrome on Android, not for Dart as a stand-alone application on android.  They have already stated that the browser is their goal, so I'm guessing Android native dart would just be an experiment by a few people on the team and nothing official.

Peter Jakobs

unread,
May 8, 2013, 11:38:44 AM5/8/13
to mi...@dartlang.org
Well that is not exactly the case, they already run the dartvm with opengl es bindings on android fpr x86

Nelson Silva

unread,
May 8, 2013, 11:45:36 AM5/8/13
to mi...@dartlang.org
DartVM can be embedded and by creating native extensions you can expose the Android API to Dart (although you'll have to use the Android NDK which in turns uses JNI to call java stuff).

Ladislav Thon

unread,
May 8, 2013, 1:01:51 PM5/8/13
to mi...@dartlang.org
Well that is not exactly the case, they already run the dartvm with opengl es bindings on android fpr x86

And it's exactly what James wrote -- an experiment by a few people on the team. Well, few... I think it's one :-)

LT

Graham Wheeler

unread,
May 8, 2013, 1:04:19 PM5/8/13
to mi...@dartlang.org
James is correct; even the current x86 OpenGL Android sample is only that - a sample that a couple of people on the team worked on. We will most likely spin this out into a community project on GitHub so that others can pick it up. That said, yes, we would like to see it working on Arm once Arm support in the VM is complete.



--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
 
 

Nelson Silva

unread,
May 8, 2013, 1:24:45 PM5/8/13
to mi...@dartlang.org
Never expected Dart VM's OpenGL, Android, etc, bindings to be officially supported and I'm all for moving these to community projects as suggested in my openglui related post (https://groups.google.com/a/dartlang.org/forum/?fromgroups=#!topic/misc/KdslI0AaliU)

Still Dart VM will officially support the arm arch on Android so I was just wondering how close we are to being able to build Dart with the Android arm toolchain ? 

kc

unread,
May 8, 2013, 2:00:45 PM5/8/13
to mi...@dartlang.org
On Wednesday, May 8, 2013 6:24:45 PM UTC+1, Nelson Silva wrote:
Never expected Dart VM's OpenGL, Android, etc, bindings to be officially supported and I'm all for moving these to community projects as suggested in my openglui related post (https://groups.google.com/a/dartlang.org/forum/?fromgroups=#!topic/misc/KdslI0AaliU)


I think they should be officially supported - especially webgl/canvas. Because developers will be able to have a shared code base between a 'native' apk Android app and Chrome (desktop and mobile) apps.

Unless Google's plan is to deliberately not cross the streams for Android and Chrome. That is code in JS for a Chrome 'app' - and then code again in Java/Dalvik for Android.
Whereas MS are - code in JS/TypeScript for the web and also for Metro/Win8 via WinJS - which they may get right with Blue.

K.

Nelson Silva

unread,
May 8, 2013, 2:09:52 PM5/8/13
to mi...@dartlang.org
Well, i believe Google will soon make Chrome packaged apps available on Android and make these "first class citizens"... i just hope that by then Dart is part of Chrome...

Google already provides WebGL, Canvas, etc.. as part of Chrome/Blink so rewriting is probably not high on their priorities... perhaps Blink will enable us to just use some bits and pieces... perhaps we could reuse these along with the existing dart:webgl bindings in and embedded Dart VM. 

kc

unread,
May 8, 2013, 2:25:32 PM5/8/13
to mi...@dartlang.org
On Wednesday, May 8, 2013 7:09:52 PM UTC+1, Nelson Silva wrote:
Well, i believe Google will soon make Chrome packaged apps available on Android and make these "first class citizens"... i just hope that by then Dart is part of Chrome...


That would be a way forward. And Dart could be the way Google unifies it's platforms - not all at once - first core libs and 2D/3D graphics. Maybe Google IO will yield some answers.

But currently: 

From the Chrome packaged apps FAQ:
Will apps work on Android?
If your app is pure HTML, CSS3, and JavaScript and is hosted on your servers there is a good chance that it will work in the browser on Android. However, .crx files (including packaged apps) are not supported on Android. Users cannot install their apps onto the Android browser, but they can most likely use those apps by directly accessing the app's URL.

K.



solarwirelessmile

unread,
May 8, 2013, 2:59:44 PM5/8/13
to mi...@dartlang.org
I was able to cross-compile Dart for ARM (on Linux) with yesterday's sources and get some simple "Hello, Dart!" programs running on the BeagleBone Black under Angstrom.  I followed the online directions for "How to build and test the Dart project" with a setting of --arch=arm. (If you add --mode=release you'll get builds corresponding out/ReleaseARM/dart). I specified the ARM toolchain during my setup, following the directions at "How to set up your machine to build Dart".

Cross-compiling the build failed late in the process, when it was compiling some of the documentation, but I was past the step where it successfully built the Dart executable: LINK(target) out/DebugARM/dart

I was able to take that binary, copy it onto the BeagleBone Black and successfully run some simple Dart programs on ARM.

The BeagleBone Black also supports Android - so that could be a potential future test platform.

Nelson Silva

unread,
May 8, 2013, 4:13:47 PM5/8/13
to mi...@dartlang.org
I tried it today but if you add the --os=android flag most of the stuff is hard coded for ia32 and the linux_x86 compiler.. I'm on Linux 64 bit which probably doesn't help either... I'll try to play some more with it tomorrow.
--

Nelson Silva

unread,
May 9, 2013, 1:23:02 PM5/9/13
to mi...@dartlang.org
Hi all,

After struggling with several hardcoded ia32/x86 settings and with skia i finally managed to build dart on Android " tools/build.py -m release -a arm --os=android samples"

Unfortunately I can't get any of the samples running on my device :

ActivityManager(  357): Start proc com.google.dartndk for activity com.google.dartndk/.DummyActivity: pid=27517 uid=10090 gids={50090, 1028}
DartExt (27517): Creating isolate /data/data/com.google.dartndk/app_dart/main.dart, main
DartExt (27517): OpenFile
DartExt (27517): Couldn't create isolate: Unable to find dart source for dart:core
DartExt (27517): CreateIsolateAndSetup: Unable to find dart source for dart:core

I've seen a couple of commits about loading the core libraries from sources and was wondering if the embedded samples have been update to reflect this ?

In the meantime i've copied a couple of methods from bin/dart_utils.c to pass to Dart_Initialize which seem to be needed for reading these core libraries....

Sorin Mihai Irimies

unread,
Jul 14, 2013, 8:10:56 AM7/14/13
to mi...@dartlang.org

HI Nelson,

I am trying to build dart for android. Would it be possible to write a short how to on how you did it.
It would be greatly appreciated.
Message has been deleted

Nelson Silva

unread,
Jul 16, 2013, 5:25:12 AM7/16/13
to mi...@dartlang.org
Hi,

I've posted my reply here yesterday but today it shows that "This message has been deleted" so let me try again:

I just did a clean checkout and build for ARM a couple of weeks ago so i took some quick notes of the changes and build process:
 
 
 # Get the source
 gclient config
http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps
 echo
"target_os = ['android']" >> .gclient
 gclient sync
 
 
# Make some changes:
 
# tools/build.py
 
104: if not arch in ['ia32', 'arm']:
 
107: if target_arch not in ['ia32', 'arm']:
 
161: toolchain_arch = 'arm-linux-androideabi-4.4.3'
 
188: target_arch=arm
 
421: toolchainprefix = ('%s/arm-linux-androideabi' % os.environ['ANDROID_TOOLCHAIN'])
 
 
# tools/gyp/all.gypi
 
12: 'target_arch': 'arm'
 
+13: 'armv7': 0
 
 
# tools/gyp/configurations_android.gypi
 
21: 'android_ndk_sysroot': '<(android_ndk_root)/platforms/android-14/arch-<(android_target_arch)',
 
36: 'android_target_arch' : 'arm',
 
 
# runtime/vm/assembler_arm.cc
 
14: //#if !defined(USING_SIMULATOR) && !defined(__linux__)
 
15: //#error ARM cross-compile only supported on Linux
 
16: //#endif
 
 
# Build
 tools
/build.py -m release -a arm --os=android -v dart
 
 
# Push dart to android
 adb push
out/android/ReleaseARM/dart /data/local/tmp/dart
 
 
# Push some benchmarks and/or examples
 adb push hello
.dart /data/local/tmp/dart
 
 
# Run it
 adb shell
/data/local/tmp/dart /data/local/tmp/hello.dart


Hope this helps.

Sorin Mihai Irimies

unread,
Jul 23, 2013, 1:15:32 PM7/23/13
to mi...@dartlang.org
HI Nelson,
Thx for the thorough information. I forgot to tell you that I am trying to build it on an Ubuntu 13.04 32 bit machine. Would that work?


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new
 
 

Sorin Mihai Irimies

unread,
Jul 23, 2013, 7:00:37 PM7/23/13
to mi...@dartlang.org
Hi,
I looked up closer and there was one more place where I needed to rename into arm in the build.py.
It started compiling but I got to a point in which I received this message:

arm-linux-androideabi-g++: muldefs: No such file or directory
make: *** [out/android/ReleaseARM/dart] Error 1
BUILD FAILED

Could it be due to symbolic linkage?
Did you also encountered this problem?

Sebastien Deleuze

unread,
Jun 6, 2014, 2:59:39 AM6/6/14
to mi...@dartlang.org
Please vote (star) this issue if you are interested about building native Android applications with Dart : https://code.google.com/p/dart/issues/detail?id=19266
Reply all
Reply to author
Forward
0 new messages