facebook / facebook-sdk-for-unity

The facebook sdk for unity.
https://developers.facebook.com/docs/unity
Other
485 stars 256 forks source link

Android 34 / FB SDK - can't build ( A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade ) #714

Open simonechelo-sybo opened 6 months ago

simonechelo-sybo commented 6 months ago

Checklist

Environment

Goals / Expected Results

I am trying to build a project for Android, using Target API level 34, that uses FB SDK 16.0.2. It works on Target API level 33, and breaks on 34

Actual Results

Build fails.

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > AAPT2 aapt2-4.0.1-6197926-osx Daemon #0: Unexpected error during link, attempting to stop daemon.
     This should not happen under normal circumstances, please file an issue if it does.

Full stacktrace: Editor.log

Steps to Reproduce

Empty project. Set it up. Download FB SDK 16.0.2 from here Install .unitypackage Build for Android.

Code Samples & Details

Here's an empty project with just the FB SDK as external package. This builds on Android 33, and not on Android 34 Empty Proj - FB SDK failing.zip

Ajasmm3plus commented 5 months ago

Do you have any updates on this? Are there any workarounds or other SDK versions?

RaidelRoss commented 5 months ago

I have the same issue. Any thoughts on this? Any solutions? Here you can download other versions: https://developers.facebook.com/docs/unity/downloads/ I will be trying others to see if any work.

RaidelRoss commented 5 months ago

I have the same issue for: ->facebook-unity-sdk-15.1.0 ->facebook-unity-sdk-16.0.0 ->facebook-unity-sdk-16.0.1 ->facebook-unity-sdk-16.0.2

in: ->Unity 2021.2.32f1 ->com.google.external-dependency-manager:1.2.177(I can't use the Facebook ; it's not compatible with other SDKs) ->gradle-5.1.1

PlayaPeter commented 5 months ago

Same issue with Unity 2021.3.28f1 and SDK version 14.0.1. Tried Android target API level 30 and 34. Both fail. Android target API level 33 works.

AlanLiu90 commented 5 months ago

Same issue with Unity 2020.3.48. Changing compileSdkVersion to 33 (while keeping targetSdkVersion 34) in launcher/build.gradle in the exported gradle project seemed to work. Although there is an error (The compileSdkVersion (33) should not be lower than the targetSdkVersion (34)) shown in Android Studio, but it builds successfully.

SyaoranChang commented 4 months ago

Same issue with Unity 2021.3.31f1 and SDK version 16.0.2. Same as PlayaPeter tried Android target API level 34, but build fail. Switch to Android target API level 33 works. I hope to fix the issue of not being able to use Android target API level 34 for building.

Ajasmm3plus commented 4 months ago

Because of this I have to take build in Android studio.

kocburak commented 3 months ago

@Ajasmm3plus How did you managed to build with andorid export ? I couldn't make it work.

Awais6 commented 3 months ago

I have the same issue, It occurs on Facebook SDK latest version 17.0.1

image

WilliamHiiTW commented 2 months ago

Because of this I have to take build in Android studio.

@Ajasmm3plus Is it possible for you to show complete steps on how you bypass this error by taking build in Android studio?

Awais6 commented 1 month ago

No one here to resolve the issue on facebook latest SDK 17.0.1, any work around?

s4relok commented 1 month ago

What's wrong?

Unity 2021.3 using Build Tools installed with Unity: build-tools v. 30.0.2 To build with FB you need Target API Level 34 AND Build Tools v. 34+

How to solve it

  1. Install Build Tools v. 34+ using Android Studio
  2. Open gradleTemplate.properties (from Assets/Plugins/Android)
  3. Add at the end:
    **ADDITIONAL_PROPERTIES**
    android.aapt2FromMavenOverride=c:/Users/USER/AppData/Local/Android/Sdk/build-tools/34.0.0/aapt2.exe
ajaybirla-fabzen commented 1 month ago

What's wrong?

Unity 2021.3 using Build Tools installed with Unity: build-tools v. 30.0.2 To build with FB you need Target API Level 34 AND Build Tools v. 34+

How to solve it

  1. Install Build Tools v. 34+ using Android Studio
  2. Open gradleTemplate.properties (from Assets/Plugins/Android)
  3. Add at the end:
**ADDITIONAL_PROPERTIES**
android.aapt2FromMavenOverride=c:/Users/USER/AppData/Local/Android/Sdk/build-tools/34.0.0/aapt2.exe

@s4relok Working great. Thanks. :pray:

kurisunoob commented 1 month ago

What's wrong?

Unity 2021.3 using Build Tools installed with Unity: build-tools v. 30.0.2 To build with FB you need Target API Level 34 AND Build Tools v. 34+

How to solve it

  1. Install Build Tools v. 34+ using Android Studio
  2. Open gradleTemplate.properties (from Assets/Plugins/Android)
  3. Add at the end:
**ADDITIONAL_PROPERTIES**
android.aapt2FromMavenOverride=c:/Users/USER/AppData/Local/Android/Sdk/build-tools/34.0.0/aapt2.exe

It's work for unity build But using com.google.android.appbundle, the error is reported again

EmreYapar commented 1 month ago

none of the solutions above work for me, anyone found another solution?

Awais6 commented 1 month ago

none of the solutions above work for me, anyone found another solution?

I have removed the SDK and now using graph API link (REST Api) for login, it works like a charm and let you get rid of buggy SDK.

DarkYuanJs commented 1 month ago

上述解决方案对我都不起作用,有人找到了其他解决方案吗?

你要检查你的sdk目录是否下载好,那个34.0.0

KRKimJaeSeop commented 3 weeks ago

Try to raise the Minimum API Level. In my case, it works because I raise it to 24...

joaovitoraramo commented 2 weeks ago

In my case: compileSdkVersion = 33 targetSdkVersion = 34

This solve the problem and makes build correctly. Btw cleans the warning in the play console about the sdk version of my app.

Edit: Don't forget to update your Android Studio or just download de newer sdk tools.

colinamuzo commented 1 week ago

I have the same issue with FBSDK 16.0.1 and Unity 2021.3.15. I will try the "android.aapt2FromMavenOverride" fix