error: object xml is not a member of package scala did you mean Nil?

Android Studio跑scala脚本时出现遇到了一个问题
error: object xml is not a member of package scala did you mean Nil?

在网上查了半天,最后找到个比较便捷的解决方案,这里写出来供参考

原因:
Links:
1.scala-xml本身代码-https://github.com/scala/scala-xml
2.stackoverflow讨论-https://stackoverflow.com/questions/24559236/object-xml-is-not-a-member-of-package-scala
原因为从scala2.11开始xml库就分离出去了

解决:
最后找到官方解答:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206632745-Can-t-import-scala-xml-

上述的方案较老,就2020.1月的Android Studio 3.5.3而言:
1.点左上角File-Project Structure
2.在弹出框中,左侧选择Dependence,添加Library Dependency


image.png

3.搜索Scala-xml,找到后点OK


Project Structure界面

4.回到原来的界面后,记得点apply

然后就妥了!Done

你可能感兴趣的:(error: object xml is not a member of package scala did you mean Nil?)