If you have not created an apklib or aar out of the facebook sdk, the
easiest way to include facebook into your project is to add the following
sbt setting:
import android.Keys._
import android.Dependencies.AutoLibraryProject
localProjects in Android <+= (baseDirectory) { b => AutoLibraryProject(b /
"path to facebook sdk relative to base") }
If it's somewhere not under base directory, you can just do
localProjects in Android += file("/path/to/facebook-sdk")
On Sun, Dec 22, 2013 at 3:28 PM, George Pligor <[email protected]>wrote:
> Hello pfn! First let me say that you have done an excellent job of
> combining Android + Scala with your plugin.
>
> Now let's take a step back. I do not know what an aar is and how to use
> it, I never needed it until now. I have only included libraries with jar
> files and regular sbt dependencies. I now only have downloaded, facebook
> sdk and I have a folder which is an apk lib.
>
> I tried some things like that: libraryDependencies +=
> android.Dependencies.aar("com.facebook" % "facebook-android-sdk" % "3.6")
> Nothing worked
>
> I guess I must take the folder, convert it somehow into something useful
> and then consume it somehow with your plugin.
>
> Could you share the steps in order to get from one step to the next? Right
> now I do not even know from where to start.
>
> Thank you!
>
>
> On Monday, December 23, 2013 1:15:32 AM UTC+2, pfn wrote:
>
>> libraryDependencies += android.Dependencies.aar("com.facebook" % .... %
>> ...)
>>
>> should do the trick, if you have multiple aar dependencies, you'll need
>> to add the classes.jar to intellij individually.
>>
>>
>> On Sun, Dec 22, 2013 at 3:01 PM, George Pligor <[email protected]>wrote:
>>
>>> I really don't get how it works from explanations found online. Until
>>> now I have just used jar files to include libraries but I guess
>>> facebook-sdk is something different.
>>>
>>> Do you have a more elaborate example of how to treat facebood-sdk in
>>> order to embed it in an Android+Scala application which is being built with
>>> sbt?
>>>
>>> Thank you
>>>
>>>
>>> On Tuesday, November 12, 2013 6:14:55 PM UTC+2, Dmitry Aleksandrov wrote:
>>>>
>>>> Hi,
>>>> my short question is: does sbt-idea can properly generate android
>>>> project structure with 2 or more AAR dependencies?
>>>>
>>>> In details. I wanted to create project, linked with android-support-v4,
>>>> android-support-v7, facebook-android-sdk, and maybe more libs in future...
>>>> android-support-v7 packaged as AAR inside google-support-repository, so
>>>> just included in my build.
>>>>
>>>> With facebook-sdk situation is a bit different. I forked sdk and added
>>>> sbt project, to publish it local as aar artifact. (see my build
>>>> https://github.com/alkersan/facebook-android-sdk/blob/
>>>> master/facebook/build.sbt)
>>>> I made an aar artifact from facebook-android-sdk and sbt published to
>>>> local .ivy2 repo. POM seems valid, with android-support-v4 dependency, but
>>>> without this jar inside aar (which I think is good, because I will add
>>>> android-support-v4 dep in my project)
>>>>
>>>> Next I started to configure my project. (https://github.com/alkersan/n
>>>> est/blob/master/project/NestBuild.scala)
>>>>
>>>> default library dependencies (with assumption that facebook-android-sdk
>>>> has already been published local)
>>>>
>>>> libraryDependencies ++= Seq(
>>>>
>>>> "com.android.support" % "support-v4" % "18.0.0",
>>>> aar("com.facebook" % "facebook-android-sdk" % "3.5.2"),
>>>> aar("com.android.support" % "appcompat-v7" % "18.0.0")
>>>> )
>>>>
>>>> Next i run my build
>>>> >sbt
>>>> >run
>>>>
>>>> And see that both AARs are resolved well.
>>>>
>>>> [info] Done updating.
>>>>
>>>> [info] Unpacking aar: facebook-android-sdk.aar to
>>>> com.facebook-facebook-android-sdk-3.5.2
>>>>
>>>> [info] Unpacking aar: appcompat-v7-18.0.0.aar to
>>>> com.android.support-appcompat-v7-18.0.0
>>>>
>>>> [info] Collecting resources
>>>>
>>>> [info] Performing full resource merge
>>>>
>>>> [info] Generating R.java
>>>>
>>>> [info] Packaging resources: resources-debug.ap_
>>>>
>>>> [info] Rebuilding all classes because R.java has changed
>>>>
>>>> [info] Regenerating TR.scala because R.java has changed
>>>>
>>>> compilation succeeded and application run properly. Meas that all
>>>> classes and resources are resolved. (In
>>>> NestActivity<https://github.com/alkersan/nest/blob/master/client/src/com/example/nest/NestActivity.scala>I
>>>> used both classes of compat-v7 and facebook-sdk)
>>>>
>>>> Next I tryed to generate Idea project
>>>> > sbt
>>>> > gen-idea
>>>>
>>>> But I saw that only classes.jar of appcompat-v7 were added. Indeed i
>>>> see marks of facebook resources inside /res/
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-j7QTHJ5pDV0/UoJTB9oBSzI/AAAAAAAAAm0/a_Er3WPLqkY/s1600/proj_structure.png>
>>>>
>>>> If I remove appcompat-v7 dependency from sbt, then facebook-sdk`s
>>>> classes.jar is attached after gen-idea step. Looks like when sbt-idea
>>>> generating - it looks for first AAR only.
>>>>
>>>> Have anybody tried something like this before?
>>>>
>>> --
>>> 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/groups/opt_out.
>>>
>>
>> --
> 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/groups/opt_out.
>
--
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/groups/opt_out.