我正在尝试使用Scala解析Android上的json String
override def onCreate(savedInstanceState: Bundle): Unit = {
super.onCreate(savedInstanceState)
val jsonStr:String = Source.fromInputStream(getResources.openRawResource(R.raw.catalog)).mkString("")
Log.i(TAG, jsonStr)
val result = JSON.parseFull(jsonStr)
result match {
case Some(catalog) => Log.i(TAG, catalog.toString)
case None => Toast.makeText(this, "cannot parse json", 2000).show();
}
setContentView(R.layout.activity_grid_view)
}
它编译得很好但是在android上执行时,它在JSON.parseFull上失败并带有运行时异常 java.lang.NoSuchMethodError:scala.collection.immutable.StringLike.toString
我正在使用scala 2.10.3
看起来像scala本身的错误