2

我正在尝试使用“gdata-scala-client”导入使用 scala 的谷歌联系人。我按照这里的说明进行操作,这是我的示例代码

import com.google.gdata.Service
import com.google.gdata.data.StdAtomFeed

object Con extends App {
println("hey")
val s = new Service("comp-test-1.0", "cp") {}
s.setUserCredentials("scalaprogrammer1@gmail.com", "xxxxxxxx")
val atomFeed = new StdAtomFeed
 val f = s.query("http://www.google.com/m8/feeds/contacts/scalaprogrammer1%40gmail.com/base", atomFeed.feedPickler)
 for (e <- f) println(e.title)
}

但我得到了这个例外:

Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.JavaConversions$.asMap(Ljava/util/Map;)Lscala/collection/mutable/Map;
    at com.google.gdata.client.HttpConnection$HttpResponse.headers(HttpConnection.scala:215)
    at com.google.gdata.client.ClientLoginFactory.getToken(ClientLoginFactory.scala:104)
    at com.google.gdata.client.ClientLoginFactory.setUserCredentials(ClientLoginFactory.scala:59)
    at com.google.gdata.Service.setUserCredentials(Service.scala:62)
    at Con$delayedInit$body.apply(Con.scala:9)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
    at scala.App$class.main(App.scala:71)
    at Con$.main(Con.scala:6)
    at Con.main(Con.scala)

我是 scala 的新手,有人可以建议我在哪里缺乏吗?

4

0 回答 0