Akka on Android

 ̄綄美尐妖づ 提交于 2019-12-24 03:14:23

问题


I have a problem with running akka on android. My App crashes once I start it. I use Akka 2.3.5, Scaloid 3.5-10.

I start my SignInActivity with

private implicit val system = ActorSystem("signin")  // this throws the error above
override def onCreate(savedState: Bundle): Unit = {
    super.onCreate(savedState)
    setContentView(R.layout.signin)
    val etMail = find[EditText](R.id.etMail)
    val etPass = find[EditText](R.id.etPass)
    find[Button](R.id.signInBtn).setOnClickListener(new OnClickListener {
      override def onClick(v: View): Unit = {
        signIn(etMail.text.toString, etPass.text.toString)
      }
    })

09-21 11:35:34.601  10789-10789/at.itn.android E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: at.itn.android, PID: 10789
    java.lang.NoSuchMethodError: scala.collection.immutable.HashSet$.empty
            at akka.actor.ActorCell$.<init>(ActorCell.scala:336)
            at akka.actor.ActorCell$.<clinit>(ActorCell.scala)
            at akka.actor.RootActorPath.$div(ActorPath.scala:159)
            at akka.actor.LocalActorRefProvider.<init>(ActorRefProvider.scala:464)
            at akka.actor.LocalActorRefProvider.<init>(ActorRefProvider.scala:452)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$2.apply(DynamicAccess.scala:78)
            at scala.util.Try$.apply(Try.scala:191)
            at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:73)
            at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:84)
            at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:84)
            at scala.util.Success.flatMap(Try.scala:230)
            at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:84)
            at akka.actor.ActorSystemImpl.liftedTree1$1(ActorSystem.scala:584)
            at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:577)
            at akka.actor.ActorSystem$.apply(ActorSystem.scala:141)
            at akka.actor.ActorSystem$.apply(ActorSystem.scala:108)
            at at.itn.android.gui.activities.SignInActivity.<init>(SignInActivity.scala:20)

I dont really see how this definition could be of any trouble though. Maybe it's a proguard.cfg problem?

java.lang.NoSuchMethodError: scala.collection.immutable.StringLike.toString

Someone had a kind of similar problem and fixed it with some correct proguard options. I do have the SeqLike Part in my proguard, but maybe something else is missing.

Has anyone an idea what I'm doing wrong?

PS: I did make a similiar post before (Akka on Android multiple reference.conf - different akka problem though) , but since I couldn't get working until now I posted another akka question.


回答1:


One can check the library dependencies by looking at the project pom file from Maven repository:

Akka 2.3.5, Scaloid 3.5-10

You can see that Akka relies on scala-library 2.10.4 and Scaloid on 2.11.2. If you want to use them in the same project/classpath, they need to have the same version of dependency libraries (ideal case) or have backward compatible versions, in order to avoid classpath clashes.



来源:https://stackoverflow.com/questions/25958027/akka-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!