本文介绍了阿卡在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行在Android上阿卡的一个问题。我的应用程序崩溃,一旦我启动它。我用阿卡2.3.5,Scaloid 3.5-10。

我开始我的 SignInActivity 的用

 私人隐含VAL系统= ActorSystem(登入)//,这将引发上述错误
覆盖高清的onCreate(savedState:捆绑):单位= {
    super.onCreate(savedState)
    的setContentView(R.layout.signin)
    VAL etMail =找到[EditText上(R.id.etMail)
    VAL etPass =找到[EditText上(R.id.etPass)
    找到[按钮](R.id.signInBtn).setOnClickListener(新OnClickListener {
      覆盖高清的onClick(V:查看):单位= {
        签到(etMail.text.toString,etPass.text.toString)
      }
    })11月9日至21日:35:34.601 10789-10789 / at.itn.android E / AndroidRuntime:致命异常:主要
    工艺:at.itn.android,PID:10789
    java.lang.NoSuchMethodError:scala.collection.immutable.HashSet $​​ .empty
            。在akka.actor.ActorCell $<&初始化GT;(ActorCell.scala:336)
            在akka.actor.ActorCell $< clinit>(ActorCell.scala)
            。在akka.actor.RootActorPath $格(ActorPath.scala:159)
            在akka.actor.LocalActorRefProvider<初始化方式>(ActorRefProvider.scala:464)
            在akka.actor.LocalActorRefProvider<初始化方式>(ActorRefProvider.scala:452)
            在java.lang.reflect.Constructor.constructNative(本机方法)
            在java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            在akka.actor.ReflectiveDynamicAccess $$ anonfun $ createInstanceFor $ 2.适用(DynamicAccess.scala:78)
            在scala.util.Try $。适用(Try.scala:191)
            在akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:73)
            在akka.actor.ReflectiveDynamicAccess $$ anonfun $ createInstanceFor $ 3.apply(DynamicAccess.scala:84)
            在akka.actor.ReflectiveDynamicAccess $$ anonfun $ createInstanceFor $ 3.apply(DynamicAccess.scala:84)
            在scala.util.Success.flatMap(Try.scala:230)
            在akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:84)
            在akka.actor.ActorSystemImpl.liftedTree1 $ 1(ActorSystem.scala:584)
            在akka.actor.ActorSystemImpl<初始化方式>(ActorSystem.scala:577)
            在akka.actor.ActorSystem $。适用(ActorSystem.scala:141)
            在akka.actor.ActorSystem $。适用(ActorSystem.scala:108)
            在at.itn.android.gui.activities.SignInActivity&下;初始化>(SignInActivity.scala:20)。

我真的不看这个定义怎么可能有任何问题的,但。也许这是一个的 proguard.cfg 的问题?

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

有人有一种类似的问题,并与一些正确的ProGuard选择固定它。我确实有SeqLike部分在我ProGuard的,但也许别的东西丢失了。

有没有人一个想法是什么,我做错了?

PS:我做之前( - 不同阿卡问题虽然),但因为我不能得到工作,直到我现在贴出另一个阿卡问题


解决方案

我们可以通过观察从Maven仓库项目POM文件检查库的依赖

阿卡2.3.5 ,的

您可以看到,阿卡依靠斯卡拉库2.10.4和Scaloid上2.11.2。
如果你想在同一个项目/ classpath中使用它们,它们需要有依赖库相同版本的(理想情况下)或具有向后兼容的版本,以避免冲突的类路径。

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.

解决方案

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.

这篇关于阿卡在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 14:02