I have checked out the sbt-android project source at commit de0b517 and then tried to run the android:package
task in the example project multiproject-same-dependencies
. I get these errors:
[error] (b/android:apkbuild) This project cannot build APK, it has set 'libraryProject in Android := true'
[error] (c/android:apkbuild) This project cannot build APK, it has set 'libraryProject in Android := true'
[error] (d/android:apkbuild) This project cannot build APK, it has set 'libraryProject in Android := true'
I have been following the layout in this project to try and build my own android project with two submodules and am hitting the same error there. One submodule is itself an android library (which I get an error for), and the other is just some java sources with no android dependencies.
I don't know if this is relevant, but on my system, the example project didn't build out of the box. I made these changes:
project/build.properties
setting sbt.version=0.13.9
project/plugins.sbt
setting addSbtPlugin("org.scala-android" % "sbt-android" % "1.6.1")
I realize that these changes can be avoided by using a global installation in ~/.sbt
, but I am trying to emulate my actual project's settings which explicitly import these in order to make it more self-contained and portable by minimizing environmental dependencies.
This is the build.sbt
for my personal project if it helps:
val androidSettings = Seq(platformTarget := "android-15", dexMulti := true)
javacOptions in Compile ++= Seq("-source", "1.7", "-target", "1.7")
lazy val actionbarsherlock =
project
.settings(exportJars := true)
.settings(androidBuildAar)
.settings(androidSettings: _*)
lazy val util =
project
.settings(exportJars := true)
lazy val androminion =
project
.dependsOn(util)
.androidBuildWith(actionbarsherlock)
.settings(androidSettings: _*)
.settings(exportJars := true)
libraryDependencies in actionbarsherlock ++= Seq(
"com.android.support" % "support-v4" % "18.0.0"
)
Is this the idiomatic way to define an android project which depends on another android project and a non-android project?
Regarding my java installation:
$ java -version
java version "1.7.0_60"
Thanks!
You would run
androminion/android:package