Actually it was rather straightforward, I thought that I would have to use the command line, but the IDE was enough.
The brand new official Android IDE (AndroidStudio) in now based on IntelliJ, but for obvious reason (that is, to compile the Ceylon class !) I’ve used the Eclipse Android plugin instead.
For my first attempt, I’ve tried a naive approach, but it did not work (I can’t say I was surprised). First I’ve created an Android project, and then, I’ve activated the Ceylon builder. But it seems that the result was slightly broken. It seems that the .exploded directory was not populated (I’m not sure, I’ll double check)
Second approach :
I’ve created two projects :
- A java project with the Ceylon builder activated.
- A simple Android project.
Then, In the Android project I’ve added two entries in the classpath :
- The .exploded directory of the Ceylon project
- The ceylon.language-1.0.0.car renamed as a ‘jar’ (If you keep the ‘car’ I think that it won’t work).
Do not forget to check the ‘exported’ checkbox in the classpath options, else, these entries won’t be uploaded on your Android device. Also I think that you should update the Eclipse plugin, and maybe also use the latest SDK version (that is currently 19) because I don’t know if the plugin keep several versions of the ‘dx’ tool for each SDK version (and you must use the very latest ‘dx’ in order to be able to process the Java 7 classes from the Ceylon project).
Now, you should be be able to use your Ceylon classes in the Android project (and run the project on a device).
For now, the Ceylon project do not see the Android SDK, so for instance, you can not inherit from a class of the Android SDK. I’ll try to add the Android stub jars in the Ceylon project to check if I’m able to implement an Android Activity via a Ceylon class.
But, of course, it would be great to make the first approach work, that is, to have a real hybrid Ceylon-Android project.