Search code examples
facebookantfacebook-android-sdkaarunreal-engine4

Convert Facebook Android SDK .aar file to Java Library Project


I'm trying to convert facebook android sdk .aar file to Java Library Project (and use it in Unreal Engine 4 as OnlineSubsystem).

What i've done (according to this answer - AAR in Eclipse ANT project):

  1. Download facebook-android-sdk-4.10.1, unzip it, rename facebook-android-sdk-4.10.1.aar to facebook-android-sdk-4.10.1.zip.
  2. Unzip facebook-android-sdk-4.10.1.zip.
  3. Create in Eclipse new android java library project.
  4. Add classes.jar (from facebook-android-sdk-4.10.1.aar) to libs of Eclipse project.
  5. Replace res folder of eclipse project with res folder of .aar file.
  6. Create new android application and add facebook library project to android application project.
  7. Copy all from facebook .aar's AndroidManifest.xml to android application project.

When I'm trying to build application I always get these errors:

  1. res\layout\com_facebook_device_auth_dialog_fragment.xml:22: error: No resource identifier found for attribute 'cardBackgroundColor' in package 'com.facebook'
  2. res\layout\com_facebook_device_auth_dialog_fragment.xml:22: error: No resource identifier found for attribute 'cardElevation' in package 'com.facebook'

The CardView declaration (with errors) look like this:

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardBackgroundColor="@android:color/transparent"
card_view:cardElevation="10dp">

When I delete these two attributes everything works fine, but I want to know how to build my project without deleting anything.

Unreal Engine uses ant build system for building android application so, please, do not offer me to use gradle.

Thanks.


Solution

  • I realized that I should add cardview java library project from android sdk (android-sdk\extras\android\support\v7\cardview) to my facebook java library project.

    Thanks everyone.