Hi, pfn. Thanks for you reply!
> 1) libraryDependencies += "com.android.support" % "appcompat-v7" %
"22.0.0"
> 2) fixed by the above
I ended up with the following build.sbt:
resolvers ++= Seq(
"maven-repo" at
"file:///usr/local/opt/android-sdk/extras/android/m2repository"
)
libraryDependencies ++= Seq(
"com.android.support" % "support-v4" % "22.0.0",
"com.android.support" % "appcompat-v7" % "22.0.0",
"net.liftweb" %% "lift-json" % "2.6.2"
)
'sbt update' seems to have found all the libraries and have downloaded them.
But for some reason I still couldn't import them in my code:
> console
[info] Processing resources
[info] Compiling 2 Scala sources and 3 Java sources to [...]/bin/classes...
[warn] No main class detected
[info] Packaging [...]/bin/classes.jar ...
[info] Done packaging.
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java
1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import android.support.v4
<console>:7: error: object support is not a member of package android
import android.support.v4
^
scala> import net.lifweb.json
<console>:7: error: not found: value net
import net.lifweb.json
(I've removed reference to these libraries from my source code before
running sbt console. Adding 'import ...' lines to source files yields the
same result.)
I can see lift-json folder in IDEA at "SBT: sbt-and-plugins" section of
Project pane, but IDEA doesn't recognize (fail to provide auto-completion,
etc.) library classes as well.
What did I do wrong?
> 3) intellij 14.1 can kind of run sbt tasks now, not the greatest, but can
be used to start/run the build
Thanks for hint. I added 'android:package' SBT task to IDEA. So now I can
run this task, and then click the usual run button, and I can see my app
running on emulator – that's cool :) The only thing I wish I had – when I
click debug log of SBT I wish corresponding file/line in IDE was selected.
Could that be done?
> 4) please go through the getting started guide at
http://www.scala-sbt.org/0.13/tutorial/index.html
Thanks, looked it through. Though it looks like most of the magic is in
specific android tasks, not SBT itself.
четверг, 16 апреля 2015 г., 19:27:57 UTC+3 пользователь pfn написал:
>
> 1) libraryDependencies += "com.android.support" % "appcompat-v7" % "22.0.0"
> 2) fixed by the above
> 3) intellij 14.1 can kind of run sbt tasks now, not the greatest, but can
> be used to start/run the build
>
> 4) please go through the getting started guide at
> http://www.scala-sbt.org/0.13/tutorial/index.html
>
> On Thu, Apr 16, 2015 at 5:23 AM Eugene <[email protected] <javascript:>>
> wrote:
>
>> Hi guys!
>>
>> I'm new to Android development, and have decided to start with Scala.
>>
>> I have Mac OS, I've installed fresh version IntelliJ IDEA, installed
>> (with Homebrew) android-sdk and sbt.
>> Then I installed with 'android' utility SDK version 22 and extras
>> (Android Support Repository, Android Support Library, Google Repository).
>>
>> Now I have the following lines in my code:
>>
>> import android.support.v4.app.Fragment
>> import android.support.v7.app.ActionBarActivity
>> [...]
>>
>> class MainActivity extends ActionBarActivity with TypedActivity { ... }
>>
>>
>> Now when I run 'sbt compile' in command line, I have the following errors:
>>
>> [error] [...]/src/main/scala/MainActivity.scala:4: object support is not
>> a member of package android
>> [error] import android.support.v4.app.Fragment
>> [error] ^
>> [error] [...]/src/main/scala/MainActivity.scala:5: object support is not
>> a member of package android
>> [error] import android.support.v7.app.ActionBarActivity
>> [error] ^
>> [error] [...]/src/main/scala/MainActivity.scala:14: not found: type
>> ActionBarActivity
>> [error] class MainActivity extends ActionBarActivity with TypedActivity {
>>
>> (1) What is the right way to solve this problem?
>>
>> I tried to add symbolic link (ln -s) to libs/ folder from
>> android-support-v4.jar and android-support-v7-appcompat.jar in my SDK
>> directory. That solved this particular error.
>>
>> (2) But then again, new error arouse (ProGuard "can't write
>> resource"/"duplicate zip")
>>
>> And symbolically linking framework libraries doesn't look like the right
>> way in the first place. How do I solve that one?
>>
>> (3) Third question: How do I make IDEA build with SBT?
>>
>> It's obvious to me that by default it uses some other mechanism to build
>> project. I can add android-support-v4/v7 jars to "Project
>> Structure"/Libraries list. Then IDEA will see ActionBarActivity definitions
>> and will compile fine. But it doesn't change SBT's behavior (it fails as
>> described above). And still error (2) arises again.
>>
>> My build.scala file contents:
>>
>> object Build extends android.AutoBuild
>>
>> plugins.sbt:
>>
>> addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.3.20")
>>
>>
>> Thanks for your help!
>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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.