Using scala-library.jar in an Android project throws error: Library cannot be dexed

孤人 提交于 2019-12-23 02:05:27

问题


I have a very simple Android project set up that uses:

  • Several custom Scala JARs that are going to perform some functionality for my app
  • scala-library.jar version 2.9.1 final so the Scala jars can run

However, whenever I try to launch the app, I get errors saying that the scala-library cannot be Dexed because it is too large.

Googling shows that this is a problem, but I am unsure how to fix it. Some say Proguard is the answer, but I don't know how to do that.

I don't currently use Ant for any build management, just Eclipse tools.

Any help or tips?


回答1:


You should use ProGuard prior to dexing the standard library.

There is an sbt plugin for Scala Android projects available here: https://github.com/jberkel/android-plugin/

The Getting Started guide is quite detailed: https://github.com/jberkel/android-plugin/wiki/getting-started

This plugin automatically uses ProGuard.

If you want to use ProGuard manually yourself, check out: http://proguard.sourceforge.net/index.html#manual/usage.html



来源:https://stackoverflow.com/questions/11215718/using-scala-library-jar-in-an-android-project-throws-error-library-cannot-be-de

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