Hello!

I tried to use an android-sdk-plugin(1.2.16) under sbt(0.13.2) to setup all 
of dependencies for my project, although I've been stuck for quite a long 
period of time unable to solve a problem. Actually the problem is with 
passing Android resources from one subproject to another.

Desirable project structure:
[root] project
- [application] project
- - depends on scaloid and universal-image-loader
- - depends on [pulltorefresh], [vksdk] and [common] subprojects
- [common] subproject
- - depends on actionbarsherlock apklib and android-support
- [vksdk] subproject
- [SmoothProgressBar] subproject
- [pulltorefresh] subproject
- - depends on [SmoothProgressBar] subproject

So the directories in a proj folder are: application, vksdk, common, 
pulltorefresh, SmoothProgressBar (and project, of course).

As I understand, I don't have to make a project entry explicitly in 
Build.scala for all of local projects, a reference in project.properties 
file would be sufficient. Anyway, I've tried both ways. What I need is to 
use resources from [SmoothProgressBar] in [pulltorefresh] subproject. And 
it fails:

[error] (application/android:autolibs) 
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
> ...
> [error] <proj 
> root>/application/../pulltorefresh/res/values/styles.xml:19: error: Error 
> retrieving parent for item: No resource found that matches the given name 
> 'SmoothProgressBar'.


Actually, I tried to copy that styles.xml file into an [application] 
project with a
android.library.reference.1=../SmoothProgressBar/src/main
line in application/project.properties file and it builds successfully.

That's my Build.scala file for now:

object ProjectBuild extends Build {
>   lazy val root = Project(id = "root", base = file(".")) settings(
>     android.Plugin.androidCommands ++ Seq(
>       packageDebug        <<= packageDebug in Android in application
>     ): _*) aggregate(
>       common, application)
>   lazy val application: Project = Project(
>     id = "application", base = file("application")) settings(
>     androidSettings(common): _*) settings(
>       name := "asocial",
>       libraryDependencies ++= Seq(
>         "org.scaloid" %% "scaloid" % "3.4-10",
>         "com.nostra13.universalimageloader" % "universal-image-loader" % 
> "1.9.2"
>       )
>     ) dependsOn(common)
>   lazy val common = Project(
>     id = "common", base = file("common")) settings(androidSettings(): _*) 
> settings(
>     exportJars := true,
>     libraryProject in Android := true,
>     libraryDependencies ++= Seq(
>       apklib("com.actionbarsherlock" % "actionbarsherlock" % "4.4.0"),
>       "com.android.support" % "support-v4" % "18.0.0"
>     )
>   )
>   lazy val commonSettings = Seq(
>     scalaVersion := "2.11.0",
>     compileOrder := CompileOrder.JavaThenScala,
>     scalacOptions in Compile ++= Seq(
>       "-target:jvm-1.6", "-deprecation", "-feature"),
>     proguardScala in Android := true
>   )
>   def androidSettings(projects: Project*) =
>     commonSettings ++ android.Plugin.androidBuild(projects: _*) ++ Seq(
>       platformTarget in Android := "android-19",
>       proguardCache in Android ++= Seq(
>         //some opts, don't think it's relevant
>       ),
>       proguardOptions in Android ++= Seq(
>         //some proguard opts
>       )
>     )
> }


As I wrote earlier, I tried also to make an explicit subproject 
definitions, like this:

> lazy val smoothProgressBar = Project(
>   id = "smoothProgressBar", base = file("SmoothProgressBar/src/main")) 
> settings(androidSettings(): _*) settings(
>   exportJars := true,
>   libraryProject in Android := true
> )


And this is a project.properties file for pullToRefreshProject:

> target=android-19
> android.library=true
> android.library.reference.1=../SmoothProgressBar/src/main


I also tried to replace a [smoothProgressBar] local project with an aar 
dependency but the result is identical.
So this route is ok: root(explicit)→application(explicit, not a 
lib)→SmoothProgressBar(via proj.prop, lib)
But this fails: root→application→pulltorefresh(via proj.prop, 
lib)→SmoothProgressBar(via proj.prop, lib)
And, for example, this fails too: root→application→pulltorefresh(explicit, 
lib, export jar, has an aar with SmoothProgressBar in deps)
So how can I manage this?..

with regards,
Yan.

-- 
You received this message because you are subscribed to the Google Groups 
"scala-on-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to