facebook-sdk-for-unity icon indicating copy to clipboard operation
facebook-sdk-for-unity copied to clipboard

Unity2019 Build Failed when set Target API 31

Open klpk opened this issue 2 years ago • 1 comments

Environment

  • Unity Editor Version: 2019.4.39f1 or 2019.4.40f1
  • Facebook Unity SDK Version: 11.0.0 or 14.1.0

Goals

Build APK with Android Target API Level 31 Because this is PlayStore new app's requirement.

Actual Results

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\WorkStation\TestAPI\Temp\gradleOut\launcher\build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':launcher'.

    Failed to apply plugin [id 'com.android.internal.version-check'] Minimum supported Gradle version is 6.1.1. Current version is 5.1.1. If using the gradle wrapper, try editing the distributionUrl in C:\WorkStation\TestAPI\Temp\gradleOut\launcher\gradle\wrapper\gradle-wrapper.properties to gradle-6.1.1-all.zip

BUILD FAILED in 7s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

CommandInvokationFailure: Gradle build failed. C:/Program Files/Unity/Hub/Editor/2019.4.40f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.4.40f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\WorkStation\TestAPI\Temp\gradleOut\launcher\build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':launcher'.

Failed to apply plugin [id 'com.android.internal.version-check'] Minimum supported Gradle version is 6.1.1. Current version is 5.1.1. If using the gradle wrapper, try editing the distributionUrl in C:\WorkStation\TestAPI\Temp\gradleOut\launcher\gradle\wrapper\gradle-wrapper.properties to gradle-6.1.1-all.zip

Steps to Reproduce

Create a new project with unity 2019, import facebook unity sdk 11.0.0 or newest 14.1.0. Set Target API Level to 31 in player settings. I had already try this: https://developers.google.com/ar/develop/unity-arf/android-12-build Build APK via UnityMenu directly.

It will build success if i make project with unity 2020 or 2021 LTS. We still dont want to upgrade our old project to use Unity 2020 if there is a way to solve this.

klpk avatar Aug 25 '22 01:08 klpk

Try exporting the project to Android Studio and use the Android Studio Gradle Upgrade Assist to make a new build with the latest gradle plugin.

vhnunes avatar Aug 30 '22 12:08 vhnunes

Customize Gradle Installed Path Solved It.

klpk avatar Oct 09 '22 03:10 klpk

@klpk can you describe your steps ?

OrdonLukasz avatar Nov 28 '22 15:11 OrdonLukasz

Customize Gradle Installed Path Solved It.

You owe us some details how to solve it. Please add in this thread

unitydevelopers-greg avatar Dec 21 '22 07:12 unitydevelopers-greg