开发者

Android doesn't recognizes Scala activity

I'm trying to play with Scala in Android but the Manifest doesn't recognizes my main/only-so-far activity.

I did the set up according to this blog post: http://novoda.com/2009/10/17/scala-on-android/ and everything works until i try to run my app, moment in which the logcat saids that it just doesn't find my Activity. the thing is all i can found about this problem is this: http://tiliman.wordpress.com/2010/02/10/android-development-with-scala/. According to this post the manifest doesn't recognizes the Activity because it ain't a Java file, so he creates a Java class that extends from Scala, which i don't think is a good solution at all.

W开发者_运维百科hat do i have to do to get started? I think i'm not missing anything.

According to previously asked questions, there seems to be no solution, i mean no one provided one. But i can't believe that using something like sbt is the only way to make full and substantial Android apps in Scala. Truly, no solution at all?

UPDATE: As for the answer given, i'll give SBT a try. But i still think that is necessary a more straightforward way to do it. In a Google Dev Fest i attended, Tim Bray practically said that you could jut make Android apps in Scala or in Java, naturally and without problems: i don't see how this fits with Manifest doesn't recognizing a Scala activity.


The page you're looking at is pretty old. I'd recommend using AndroidPlugin, which is built on top of SBT (https://github.com/jberkel/android-plugin). It handles building, testing, deploying to the emulator/device, etc.

I've got this building my android app, and the only java file I have is the autogenerated R.java.

With SBT you can also generate IDEA and Eclipse configurations, so you should be good to go.


The solution posted here uses the AndroidProguardScala plug-in, in which if the name of the scala file matches the name of the main activity, there is not problem to have your main activity written in scala.

https://stackoverflow.com/a/11084146/1287856

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜