Ceylon support in Android Developer Tools

156 views
Skip to first unread message

Festal David

unread,
Jan 10, 2014, 4:43:51 PM1/10/14
to ceylo...@googlegroups.com
Hi all,

At the following update-site : http://downloads.ceylon-lang.org/ide/david ,
you will find a recent version of the Ceylon IDE along with a new additional Ceylon-Android compatibility feature.

If you install both, you will be able to :
- Add the Ceylon nature to an Android project,
- Add Ceylon code inside your project,
- And run the project transparently as an "Android Application" either on a real device or on the ADT emulator.

If you want to use the Android API, you should import the right 'android.jar' file inside the local repository (with the name "android").

Warning :
- This is provisional work and needs further testing...
- The corresponding source will be committed ad pushed after the week-end ;-)

However if you want to give it a try, please report any problem you might encounter,

Thanks,

David.

--

Regards

David Festal


SERLI
Avenue Thomas Edison,
BP 20160,
86960 FUTUROSCOPE Cedex
Tél.: +33 6.22.54.08.19

Festal David

unread,
Jan 10, 2014, 4:47:06 PM1/10/14
to ceylo...@googlegroups.com
By the way, you might need to add the following update site to your Eclipse :

http://download.eclipse.org/tools/gef/gef4/updates/integration
--
You received this message because you are subscribed to the Google Groups "ceylon-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceylon-dev+...@googlegroups.com.
To post to this group, send email to ceylo...@googlegroups.com.
Visit this group at http://groups.google.com/group/ceylon-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Gavin King

unread,
Jan 10, 2014, 5:00:40 PM1/10/14
to ceylo...@googlegroups.com
Excellent!
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-dev+...@googlegroups.com.
> To post to this group, send email to ceylo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ceylon-dev.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Diego Coronel

unread,
Jan 10, 2014, 7:28:38 PM1/10/14
to ceylon-dev
Hi David, this is really great !!!

    I would like to try it, i have both plugins installed: your and adt. So I created the android project and imported android.jar as version 1.0.0. 

 Can you help me with some doubts?


1 - I would like to know if i need to create a module or it can be developed just creating the packages and the ceylon sources inside it ?

2 - Creating a ceylon source im not able to import android.* , should i do something special ? module.ceylon ?

3 - Creating an ceylon source with: shared MyActivity() extends Activity() ... how should i declare it in AndroidManifest? can it be as MainActivity or i need to know ceylon name patterns for classes name?

Sry if im doing stupid questions, but my intention is to help testing this plugin.

Tks !!!



2014/1/10 Gavin King <gavin...@gmail.com>

David Festal

unread,
Jan 11, 2014, 2:43:25 AM1/11/14
to ceylo...@googlegroups.com
Hi Diego !

You still have to create the module.ceylon file and explicitly import the android module.
As for the activity class, it seems to me that the java name and ceylon name are the same for a simple top-level ceylon class. So you should be able to use the ceylon class name inside the manifest.

David

Diego Coronel <diego....@gmail.com> a écrit :

Diego Coronel

unread,
Jan 11, 2014, 7:21:39 AM1/11/14
to ceylon-dev
Thanks David,
 
    It was really simple :) . but i got a problem, my steps were:

1-  declaring my class in AndroidManifest, my package configuration is package="myapp.ceylontest", 
2 - At my project src/ i created a ceylon module myapp.ceylontest
3 - Created MyActivity and module.ceylon (did the import to android)
4 -  Everything is compiling, but only after touch module.ceylon it found "R" resource
5 - Now my problem is make it recognize my activity in AndroidManifest, i tried:
  - android:name="MainActivity"
  - android:name=".MainActivity"
  - android:name="myapp.ceylontest.MainActivity"

and all these combinations generates a class not found like this:

01-11 08:14:54.541: E/AndroidRuntime(23856): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{myapp.ceylontest/myapp.ceylontest.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "myapp.ceylontest.MainActivity" on path: DexPathList[[zip file "/mnt/asec/myapp.ceylontest-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/myapp.ceylontest-1/lib, /vendor/lib, /system/lib]]

Any tip ?

tks again



2014/1/11 David Festal <david....@serli.com>

Stephane Gallès

unread,
Jan 11, 2014, 8:32:20 AM1/11/14
to ceylo...@googlegroups.com

Hi Diego,

I did not have the opportunity to test this new IDE so I don't exactly know how the new scheme
that David has implemented works compared to the workarounds I was using to make the Activity work.

However
android:name="myapp.ceylontest.MainActivity"
should work

Here it seems that the Ceylon compiled sources are not 'exported' to the device. With the old workaround I had to manually
add the '.export' directory to the Eclipse classpath, and check the 'exported' property in the 'classpath order' tab of Eclipse
(the Android Eclipse plugin uses this 'exported' property to decide if an entry of the classpath must be uploaded to the Android device)

Now, maybe this is not relevant with the new IDE because I think that David now uses the 'libs' directory that the Android plugin
uses to populate the Android classpath. David would know, but in the meantime maybe this might help you find why maybe you Android
class does not make it to the Android device.

David Festal

unread,
Jan 11, 2014, 8:47:13 AM1/11/14
to ceylo...@googlegroups.com
Did you check the 'Use Ceylon classes from Java' option in the Ceylon project properties page ? It looks like you didn't.

David.

David Festal

unread,
Jan 11, 2014, 8:52:55 AM1/11/14
to ceylo...@googlegroups.com
Indeed the ceylon-related classpath entries still aren't exported, but a ceylon post-build step adds all the necessary jars in the android libs directory (including an up-to-date jar of the classes generated from Ceylon source files). Then the standard ADT process uses these jars to generate the APK.

Stephane Gallès <stephan...@gmail.com> a écrit :


Hi Diego,

I did not have the opportunity to test this new IDE so I don't exactly know how the new scheme
that David has implemented works compared to the workarounds I was using to make the Activity work.

However
android:name="myapp.ceylontest.MainActivity"
should work

Here it seems that the Ceylon compiled sources are not 'exported' to the device. With the old workaround I had to manually
add the '.export' directory to the Eclipse classpath, and check the 'exported' property in the 'classpath order' tab of Eclipse
(the Android Eclipse plugin uses this 'exported' property to decide if an entry of the classpath must be uploaded to the Android device)

Now, maybe this is not relevant with the new IDE because I think that David now uses the 'libs' directory that the Android plugin
uses to populate the Android classpath. David would know, but in the meantime maybe this might help you find why maybe you Android
class does not make it to the Android device.





Stephane Gallès

unread,
Jan 11, 2014, 9:15:38 AM1/11/14
to ceylo...@googlegroups.com

OK, David, I'm looking forward to test this.
I really like this idea that you had to use the 'libs' directory because not only it is a more straightforward way to have the Android plugin export the jars, but it also is a nice way for us to understand what's happening under the hood when something does not work as expected because now we can peek into the 'libs' directory.

Diego Coronel

unread,
Jan 11, 2014, 1:18:23 PM1/11/14
to ceylon-dev
Ok, i checked it but it does not work yet.

-  I can see in bin/ folder is that theres nothing in dexedLibs/ folder, and my .exploded  folder does have both .class (MainActivity.class and module_.class

-  Another doubt is about java compiler, for android my project is using 1.6, but ceylon should compitle using 1.7, should i do something here ? 

Tks David and Stephane (i will try your approach too).

P.S: My code is atached with the bin/ folder generated,


2014/1/11 David Festal <david....@serli.com>
CeylonTest.rar

Stephane Gallès

unread,
Jan 11, 2014, 8:27:53 PM1/11/14
to ceylo...@googlegroups.com

@David, maybe I'm missing something here, but is there something that I must do to activate the Android compatibility feature ?

I'm asking because I was expecting to see news jars in the 'libs' directory but I only see the usual 'android-support-v4.jar'
(The new compatibility feature is installed, I've double checked in the Eclipse  Installation Details).

And indeed, the deployment of my Ceylon activity does not work (same problem as Diego)

As a side note, the visibilty problem  on the 'R' class is still present. Actually, when I perform a 'clean' of the project, my Ceylon
activity does not compile anymore because of 'R' being invisible. The only way to make the Ceylon source see 'R' again is to
artificially 'touch' the order of the classpath in the 'Order and Export' tab.


@Diego, if you want to try a workaround, there are two things that you must do :
  • check the 'exported' property of the 'Ceylon Project Module' in the classpath. (@David, this now works because the 'android.jar' module is not exported anymore right ?)
  • Add the 'ceylon.language' car in the classpath, but renamed as a 'jar' (and also check the 'exported' property of this entry)

Do not use any metamodel feature in the source code though (that's an other story). With the workaround I was able to deploy and run my Ceylon Activity, but I often had to 'clean' the project because I don't know why my modifications on the source of the activity were not always takens into account in the deployment.


source code wwa

Le samedi 11 janvier 2014 14:52:55 UTC+1, David Festal a écrit :

Festal David

unread,
Jan 13, 2014, 3:26:54 AM1/13/14
to ceylo...@googlegroups.com
Hi Stephane  and Diego,

You might have to restart Eclipse after enabling the Ceylon builder on the Android project (I still have to fix a bug in this regard).
Also could you give me the list of builders shown in the 'Builders' project properties page ? And the order of the project 'Build Path' entries ?
And is there any problem shown in the Problems view of the project ?

David.
--

Cordialement,

David Festal

Diego Coronel

unread,
Jan 13, 2014, 6:07:37 AM1/13/14
to ceylon-dev
Hi David,

 I tried restarting eclipse and it does not work yet, this is my builder list:

- Android Resource Manager
- Android Pre Compiler
- Java Builder
- Ceylon Builder
- Android Package Builder

My Build Path (Order And Export)

- CeylonTest/src (checked)
- CeylonTest/gen (checked)
- Android 4.4.2 (not checked)
- Android Private Libraries (checked)
- Android Dependencies (checked)
- Ceylon Language Module 1.0.0 (not checked)
- Ceylon Project Modules (not checked)




2014/1/13 Festal David <david....@serli.com>

Festal David

unread,
Jan 13, 2014, 7:28:18 AM1/13/14
to ceylo...@googlegroups.com
So, I found and fixed the problem.

I updated both plugins in :
http://downloads.ceylon-lang.org/ide/david

David.
Reply all
Reply to author
Forward
0 new messages