Java – How do I use Android with Java and a core made by Scala?

How do I use Android with Java and a core made by Scala?… here is a solution to the problem.

How do I use Android with Java and a core made by Scala?

I

created a small project using Scala (SBT + IntellijIDEA) that provided me with a set of classes and other functions that I wanted to use in Android. I call this project $core.

So, keeping that in mind, I first tried to use only scala. I tried creating an Android project with android-plugin and I got it.

But what I really want is to use my $core in an Android project and extend the $core class with Java. $core provides an API that I hope more people use who may not know Scala, so Java would be perfect. Also, I need to use Android to get into a safe route. I’ve seen some information that scala takes a long time to compile to Android and has some limitations (like parceblles).

I’ve tried using classes in eclipse via the Import Classes folder option. I even tried to generate a jar, so at least I had a way to run it without success. I always get a NoClassDef error when I try to use one of the classes in $core. I’ve also tried importing the Scala compiler library, but it didn’t work either….

The core isn’t finished yet, and I want to develop in a single environment that allows me to debug on my Android device. How do I set up all of this?

PS: Maybe it’s better to change to eclipse now? Never tried android on intellijIDEA, I can’t debug there in scala, at least with ScalaCheck….

Solution

Is it possible to get a noclassdefound error when using Scala code from java because you didn’t add the Scala library to your java project, or at least include part of the jar it uses in your Scala code?

Can you post the rest of the bug?

Related Problems and Solutions