# How to use Facebook v4 with Android Studio

**URL:** <https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876>\
**Category:** Native builds\
**Created:** [June 17, 2016, 5:46pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876 "2016-06-17T17:46:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandgate](https://forums.solar2d.com/user_avatar/forums.solar2d.com/nandgate/32/515_2.png) [@nandgate](https://forums.solar2d.com/u/nandgate)\
**Post date:** [June 17, 2016, 5:46pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/1 "2016-06-17T17:46:13Z")

</div>

While I’m thrilled that we can now use Android Studio with enterprise projects, the documentation is still a little hit and miss with regards to using plugins. &nbsp;Facebook usage is a notable omission and it is surprising that v4 is still considered beta.

I’ve been successful getting a test app and my real app working with Facebook. &nbsp;It is actually pretty straightforward which comes with a bit of relief. &nbsp;The short answer is you need to import the Facebook project that is part of the enterprise distribution. &nbsp;Here’s the step-by-step:

1. &nbsp;In your libs directory add the&nbsp;plugin.facebook.v4.jar file. &nbsp;You SHOULD NOT have any of the other facebook jars like&nbsp;bolts-android-1.1.2.jar or&nbsp;facebook\_sdk.jar.

2. &nbsp;Add the following to your app’s gradle.properties file (these values are copied from Facebook’s gradle.properties)

ANDROID\_BUILD\_MIN\_SDK\_VERSION=9  
ANDROID\_BUILD\_TARGET\_SDK\_VERSION=21  
ANDROID\_BUILD\_TOOLS\_VERSION=21.1.2  
ANDROID\_BUILD\_SDK\_VERSION=21

1. In Android Studio, select File-\>New-\>Import Module…

2. Browse to the Facebook code in the CoronaEnterprise folder in applications:

/Applications/CoronaEnterprise/Plugins/sdk-facebook/android/4.5.0/facebook

1. If you don’t already have tools and sdk version 21 installed, you’ll get errors along with links to perform the install.

2. &nbsp;In your build.gradle for the app, add the following to dependencies:

compile project(’:facebook’)

1. Clean / Rebuild / Run &nbsp;(It sometimes takes me a couple of clean, rebuild passes to get everything going)

---

<div class="post-metadata">

**Author:** ![Alan\_PlantPot](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Alan\_PlantPot](https://forums.solar2d.com/u/Alan_PlantPot)\
**Post date:** [October 25, 2016, 6:04pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/2 "2016-10-25T18:04:58Z")

</div>

Thank you, that worked for me.

In case anyone else has this issue in future, the only problem I had after doing this was a duplicate file error. For some reason the Facebook lib was duplicating it’s mdpi/hdpi/xhdpi/xxhdpi folders &nbsp;into mdpi-v4, hdpi-v4 etc. Since it also kept the original, it then threw the error. I just changed the original folder names to have the -v4 suffix, and that solved the problem. No idea why it was doing this in the first place though.

---

<div class="post-metadata">

**Author:** ![Alan\_PlantPot](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Alan\_PlantPot](https://forums.solar2d.com/u/Alan_PlantPot)\
**Post date:** [October 26, 2016, 1:32pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/3 "2016-10-26T13:32:12Z")

</div>

I’ve noticed that the v4 docs for Android Enterprise only have the Ant method. &nbsp;

Would someone at Corona be able to add the Android studio method as described by nandgate now that Corona Enterprise officially supports Android Studio? I think it will definitely save some headaches for people in future.

---

<div class="post-metadata">

**Author:** ![Ajay\_McCaleb](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@Ajay\_McCaleb](https://forums.solar2d.com/u/Ajay_McCaleb)\
**Post date:** [October 28, 2016, 9:24pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/4 "2016-10-28T21:24:53Z")

</div>

Hey everyone,

The Facebook-v4 (now known as simply “Facebook”) plugin is now out of beta:

[https://coronalabs.com/blog/2016/10/28/facebook-plugin-update-we-are-out-of-beta/](https://coronalabs.com/blog/2016/10/28/facebook-plugin-update-we-are-out-of-beta/)

And with that, the Enterprise Setup instructions have been updated for Android Studio:

[https://docs.coronalabs.com/plugin/facebook-v4/index.html#android-1](https://docs.coronalabs.com/plugin/facebook-v4/index.html#android-1)

The instructions for the stable release of the Facebook plugin supersede what nandgate had originally posted for daily build 2016.2932 and above.

Consult the new Facebook Versioning/Upgrade guide for more info:

[https://docs.coronalabs.com/plugin/facebook-v4/fbUpgrade.html](https://docs.coronalabs.com/plugin/facebook-v4/fbUpgrade.html)

---

<div class="post-metadata">

**Author:** ![kevinmartin2708](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/k/c2a13f/32.png) [@kevinmartin2708](https://forums.solar2d.com/u/kevinmartin2708)\
**Post date:** [November 30, 2016, 6:01am UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/5 "2016-11-30T06:01:36Z")

</div>

Thanks ajay for the sharing. It helped me.

---

<div class="post-metadata">

**Author:** ![Alan\_PlantPot](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Alan\_PlantPot](https://forums.solar2d.com/u/Alan_PlantPot)\
**Post date:** [October 25, 2016, 6:04pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/6 "2016-10-25T18:04:58Z")

</div>

Thank you, that worked for me.

In case anyone else has this issue in future, the only problem I had after doing this was a duplicate file error. For some reason the Facebook lib was duplicating it’s mdpi/hdpi/xhdpi/xxhdpi folders &nbsp;into mdpi-v4, hdpi-v4 etc. Since it also kept the original, it then threw the error. I just changed the original folder names to have the -v4 suffix, and that solved the problem. No idea why it was doing this in the first place though.

---

<div class="post-metadata">

**Author:** ![Alan\_PlantPot](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/58956e/32.png) [@Alan\_PlantPot](https://forums.solar2d.com/u/Alan_PlantPot)\
**Post date:** [October 26, 2016, 1:32pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/7 "2016-10-26T13:32:12Z")

</div>

I’ve noticed that the v4 docs for Android Enterprise only have the Ant method. &nbsp;

Would someone at Corona be able to add the Android studio method as described by nandgate now that Corona Enterprise officially supports Android Studio? I think it will definitely save some headaches for people in future.

---

<div class="post-metadata">

**Author:** ![Ajay\_McCaleb](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@Ajay\_McCaleb](https://forums.solar2d.com/u/Ajay_McCaleb)\
**Post date:** [October 28, 2016, 9:24pm UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/8 "2016-10-28T21:24:53Z")

</div>

Hey everyone,

The Facebook-v4 (now known as simply “Facebook”) plugin is now out of beta:

[https://coronalabs.com/blog/2016/10/28/facebook-plugin-update-we-are-out-of-beta/](https://coronalabs.com/blog/2016/10/28/facebook-plugin-update-we-are-out-of-beta/)

And with that, the Enterprise Setup instructions have been updated for Android Studio:

[https://docs.coronalabs.com/plugin/facebook-v4/index.html#android-1](https://docs.coronalabs.com/plugin/facebook-v4/index.html#android-1)

The instructions for the stable release of the Facebook plugin supersede what nandgate had originally posted for daily build 2016.2932 and above.

Consult the new Facebook Versioning/Upgrade guide for more info:

[https://docs.coronalabs.com/plugin/facebook-v4/fbUpgrade.html](https://docs.coronalabs.com/plugin/facebook-v4/fbUpgrade.html)

---

<div class="post-metadata">

**Author:** ![kevinmartin2708](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/k/c2a13f/32.png) [@kevinmartin2708](https://forums.solar2d.com/u/kevinmartin2708)\
**Post date:** [November 30, 2016, 6:01am UTC](https://forums.solar2d.com/t/how-to-use-facebook-v4-with-android-studio/339876/9 "2016-11-30T06:01:36Z")

</div>

Thanks ajay for the sharing. It helped me.
