Facebook-sdk-for-unity: [Unity 2019.1] Add Support for Embeded SDKs

Created on 11 May 2019  ·  6Comments  ·  Source: facebook/facebook-sdk-for-unity

Hi there,

Unity 2019.1 comes with its own embedded JDK, SDK and NDK and Facebook SDK doesnt seem to recognize it as in the attached image.

Screenshot 2019-05-11 at 2 23 45 AM

Please advise

Most helpful comment

Found a way out -
1) Use Android Studio and Android Studio SDK as was shown pr

Me too, but instead of missing resources - I have something like - Facebook was set incorrectly - see Facebook Settings (the Only thing missing - Android default Debug keystore) I'm currently trying every permutation with Gradle and Google Jar Resolver I can think of, but it seems like you can try using the downloading Android Studio and download through it - the SDK (built tools 28.0.3) and set them in your preferences:
image

2) Remove all of the plug-ins, Remove IAP (Unity plug-in) and remove folder Library to fully refresh the Unity Project
3) first thing first - import IAP (Unity plug-in ) - ensure that it will ask two prompts - the second one - with I made a backup ( if second prompts was not shown - Unity will not compile all of the dll/aar properly! )
Only if it was not shown - repeat step 2, create new Unity Project - try to use Unity 2018.2 - and add in there IAP, then just copy the UDP, UNITYCHANNEL, UNITYPURCHASING folders into your Unity 2018/2019 plugins folder.
4) In your Unity Build settings - check - Minify with proguard, check custom User proguard
use the following - if using other SDK, plug-ins - test and look which classes are missing, add them inside the progurd file
I'm using ; Google Play Games, Firebase Database, Admob, IAP
content of proguard:

-keep class com.facebook.unity.FB { *; }
-keep class com.google.android.gms.ads.MobileAds { *; }

GameService Rules

-keep class com.google.android.gms.* { *; }
-keep class com.google.games.bridge.
* { *; }

Don't obfuscate. We only need dead code striping.

-dontobfuscate

-keep class com.google.unity.** { *; }

5) Import all of the plug-ins except Facebook 7.15.1
6) Ensure to make an Android Resolve!
7) Necessary to Build Android - should work correctly
8) in the same Unity Editor session - import Facebook SDK - uncheck like this and import
image

Try to use Android resolve - nothing should be new!
9) now import the rest :
image

After import - try use Android resolve (not Force Resolve) - now it will fix the dependencies

10) Build Android - should work fine!

All 6 comments

Have you had an issue with your Android build? it seems that it only needed for debug and logging purposes.... Also, could you test if you have #236 ?

it was working in previous versions without any issues, now when i compile i get resouces not found errors. Even resolver is unsupported version.

Me too, but instead of missing resources - I have something like - Facebook was set incorrectly - see Facebook Settings (the Only thing missing - Android default Debug keystore) I'm currently trying every permutation with Gradle and Google Jar Resolver I can think of, but it seems like you can try using the downloading Android Studio and download through it - the SDK (built tools 28.0.3) and set them in your preferences:
image

Found a way out -
1) Use Android Studio and Android Studio SDK as was shown pr

Me too, but instead of missing resources - I have something like - Facebook was set incorrectly - see Facebook Settings (the Only thing missing - Android default Debug keystore) I'm currently trying every permutation with Gradle and Google Jar Resolver I can think of, but it seems like you can try using the downloading Android Studio and download through it - the SDK (built tools 28.0.3) and set them in your preferences:
image

2) Remove all of the plug-ins, Remove IAP (Unity plug-in) and remove folder Library to fully refresh the Unity Project
3) first thing first - import IAP (Unity plug-in ) - ensure that it will ask two prompts - the second one - with I made a backup ( if second prompts was not shown - Unity will not compile all of the dll/aar properly! )
Only if it was not shown - repeat step 2, create new Unity Project - try to use Unity 2018.2 - and add in there IAP, then just copy the UDP, UNITYCHANNEL, UNITYPURCHASING folders into your Unity 2018/2019 plugins folder.
4) In your Unity Build settings - check - Minify with proguard, check custom User proguard
use the following - if using other SDK, plug-ins - test and look which classes are missing, add them inside the progurd file
I'm using ; Google Play Games, Firebase Database, Admob, IAP
content of proguard:

-keep class com.facebook.unity.FB { *; }
-keep class com.google.android.gms.ads.MobileAds { *; }

GameService Rules

-keep class com.google.android.gms.* { *; }
-keep class com.google.games.bridge.
* { *; }

Don't obfuscate. We only need dead code striping.

-dontobfuscate

-keep class com.google.unity.** { *; }

5) Import all of the plug-ins except Facebook 7.15.1
6) Ensure to make an Android Resolve!
7) Necessary to Build Android - should work correctly
8) in the same Unity Editor session - import Facebook SDK - uncheck like this and import
image

Try to use Android resolve - nothing should be new!
9) now import the rest :
image

After import - try use Android resolve (not Force Resolve) - now it will fix the dependencies

10) Build Android - should work fine!

Stuck with same issue, @studentutu thank you for the solution but an official fix will save a lot of trouble.

Referring to @manofspirit original report, in my case, this turned out to be a Unity 2019 issue with Android keystore file locations. See this thread on the Unity forums: https://forum.unity.com/threads/problem-signing-android-build-with-provided-keystore.647092/

My issue was fixed by choosing a different keystore path in Unity Preferences, and moving my keystore to that location. After that, the build succeeded fine, and there were no errors from the Facebook SDK.

Was this page helpful?
0 / 5 - 0 ratings