I have an sbt root
project with an actionbarsherlock
subproject which I can't package into an apk.
I am able to build both projects successfully, but when I run android:package
I get errors from the root/android:dex
task where classes from actionbarsherlock are being dex'd twice:
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/actionbarsherlock/ActionBarSherlock$Implementation;
I ran last root/android:dex
and found that it is including the intermediates/class.jar
from both the root project as well as the subproject:
.../actionbarsherlock/bin/intermediates/classes.jar,
.../bin/intermediates/classes.jar
That explains the dex error but I don't know how to change my build to avoid that.
I was able to replicate this issue on a much simpler project where the root project has no source and a simple build config like:
// build.sbt for root
androidBuild
javacOptions in Compile ++= "-source" :: "1.7" :: "-target" :: "1.7" :: Nil
lazy val root = project.in(file(".")).dependsOn(abs)
lazy val abs = project.in(file("actionbarsherlock"))
and:
// build.sbt for subproject
androidBuild
javacOptions in Compile ++= "-source" :: "1.7" :: "-target" :: "1.7" :: Nil
libraryDependencies ++= Seq(
"com.android.support" % "support-v4" % "18.0.0"
)
Both projects have project/build.properties
:
sbt.version=0.13.9
and project/plugins.sbt
:
addSbtPlugin("org.scala-android" % "sbt-android" % "1.6.0")
The file hierarchy looks like:
.
├── actionbarsherlock
│ ├── AndroidManifest.xml
│ ├── build.sbt
│ ├── lint.xml
│ ├── project
│ │ ├── build.properties
│ │ └── plugins.sbt
│ ├── project.properties
│ ├── README.md
│ ├── res
│ ├── ...
│ ├── src
│ │ ├── ...
│ └── test
│ └── ...
├── AndroidManifest.xml
├── build.sbt
├── lint.xml
├── proguard-project.txt
├── project
│ ├── build.properties
│ └── plugins.sbt
├── project.properties
├── README.MD
├── res
│ ├── ...
├── src
The typical process I have been using on sbt from a clean checkout is:
project abs
compile
project root
compile
android:package
Thanks in advance!