[scala] mixed scala/android eclipse project works

View: New views
2 Messages — Rating Filter:   Alert me  

[scala] mixed scala/android eclipse project works

by Meiko Rachimow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

It seems, that a mixed Scala/Android Project works in Eclipse.

I tried it some weeks ago - without success.
And so i have done it, like described here:
http://www.scala-lang.org/node/160
(with two separate projects)

Today i managed it. The reason could be a new ADT-Plugin.

- Eclipse 3.4.1 (Classic Edition)
- ADT-Plugin (newest -> 0.8.0 )
- Scala Eclipse Plugin 2.7.2.RC2

1. Create New Android Project
2. "Add Scala Nature" on this project
3. add scala-library.jar to the build-path (use "add external JAR" )
4. Create a new Scala-Activity-Class with the same name like the
Java-Activity-Class
5. Delete the Java-Activity-Class (important: delete after creating the
scala file..., to prevent the ADT plugin from running into a bug)
6. Maybe Project->Clean (the class R is generated, resave the
scala-files, marked with errors...)

Meiko

Re: [scala] mixed scala/android eclipse project works

by Meiko Rachimow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

it is better to not delete the Java-Activity-Class...
change it to something like this:
<code>
public class Main extends MainScala {}
</code>

and then implement a scala class:
<code>
class MainScala extends Activity {
  override def onCreate(...
</code>

The AndroidManifest.xml is still referencing the  Java-Activity-Class:
(...
<application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Main"
...)

So the Android plugin will not break with some curious exceptions.

meiko


Meiko Rachimow schrieb:

> Hello
>
> It seems, that a mixed Scala/Android Project works in Eclipse.
>
> I tried it some weeks ago - without success.
> And so i have done it, like described here:
> http://www.scala-lang.org/node/160
> (with two separate projects)
>
> Today i managed it. The reason could be a new ADT-Plugin.
>
> - Eclipse 3.4.1 (Classic Edition)
> - ADT-Plugin (newest -> 0.8.0 )
> - Scala Eclipse Plugin 2.7.2.RC2
>
> 1. Create New Android Project
> 2. "Add Scala Nature" on this project
> 3. add scala-library.jar to the build-path (use "add external JAR" )
> 4. Create a new Scala-Activity-Class with the same name like the
> Java-Activity-Class
> 5. Delete the Java-Activity-Class (important: delete after creating
> the scala file..., to prevent the ADT plugin from running into a bug)
> 6. Maybe Project->Clean (the class R is generated, resave the
> scala-files, marked with errors...)
>
> Meiko
>