The Crystal Programming Language Forum

Any thoughts or conversation about JVM / JRuby / Android for Crystal

Hello !

Has there been any talk of implementing Crystal to run on the JVM / Dalvik / ART / Android stack ?

I dabble from time to time with Android development, and I keep coming back to how I hate Java. I have been doing a fair amount of work with React Native, and it’s pretty impressive. Sometimes though in my fantasy world I think, what would Android look like, with a programming language inspired by the Ruby I love and adore.

Thanks !

1 Like

Did you try Kotlin? It has most of the feature the Crystal has. It’s great!

Hey!

Binding the NDK to Crystal would certainly be possible. You would need to implement the platform support for android (iirc the calling conventions are slightly different from normal arm-abi) and fix issues like https://github.com/crystal-lang/crystal/issues/9297.

Then of course there’s the whole topic of Crystal not being an excellent candidate for shared libraries, given it requires bdwgc. But maybe that’s managable.

Meanwhile, I’d recommend you to look into Kotlin or even Flutter (+ Dart) for mobile application development :) Flutter really brings some fresh winds, sidestepping most of the aging Android framework.

I have done a bit of Kotlin and didn’t get a whole lot of satisfaction so far. I’ll probably be doing it in my next gig so I’ll be hopefully learning more.

There’s been a few people that have tried this. This is the only one I remember off the top of my head https://github.com/ysbaddaden/android.cr

But if you wanted to take a stab at it, you could get some inspiration from http://ruboto.org/ See about porting some stuff to Crystal. That would be great to be able to do android apps in crystal.

@ether_joe I second @jhass recommendation. I eventually gave up on React Native and re-engineered my app (including the elements I had written in Kotlin) in Flutter/Dart. What a difference - a much better platform for developing Android apps than React Native IMHO with first class debug support in VScode. In particular I was able to integrate Leaflet based maps that worked and that was the principle reason I embarked on the re-implementation of my app. Functional programming and excellent streams support - there is a lot to like.