azesmway / react-native-unity-play

Play an unity view in react native
MIT License
40 stars 16 forks source link

Execution failed for task ':unityLibrary:BuildIl2CppTask'. #25

Open ahalyadev opened 2 years ago

ahalyadev commented 2 years ago

I tried your example in android

Capture
StarLederer commented 2 years ago

I ran into similar problem before but i don't remember the solution. It could be missing execution permisions on your gradle file

azesmway commented 2 years ago

I tried your example in android Capture

My example is made on mac os, and you are trying to run it on windows. need to fix the path

Ramesh21071993 commented 2 years ago

I tried the command what you shared. still getting this below error. Can you please help

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 995 file(s) to forward-jetify. Using 4 workers... info JS server already running. info Installing the app...

Task :unityLibrary:BuildIl2CppTask FAILED WARNING: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [19.2.5345600] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [19.2.5345600] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings 77 actionable tasks: 3 executed, 74 up-to-date

FAILURE: Build failed with an exception.

BUILD FAILED in 11s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

BUILD FAILED in 11s

at makeError (/home/ramesh/Downloads/mytest/node_modules/execa/index.js:174:9)
at /home/ramesh/Downloads/mytest/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (/home/ramesh/Downloads/mytest/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/home/ramesh/Downloads/mytest/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.

sdk.dir = /home/ramesh/Android/Sdk ndk.dir=/home/ramesh/Android/Sdk/ndk/19.2.5345600

ahalyadev commented 2 years ago

I tried the command what you shared for Linux. still getting this below error. Can you please help

And my sdk path sdk.dir = /home/ramesh/Android/Sdk ndk.dir=/home/ramesh/Android/Sdk/ndk/19.2.5345600

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 995 file(s) to forward-jetify. Using 4 workers... info JS server already running. info Installing the app...

Task :unityLibrary:BuildIl2CppTask FAILED WARNING: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [19.2.5345600] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [19.2.5345600] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings 77 actionable tasks: 3 executed, 74 up-to-date

FAILURE: Build failed with an exception.

BUILD FAILED in 11s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

BUILD FAILED in 11s

at makeError (/home/ramesh/Downloads/mytest/node_modules/execa/index.js:174:9)
at /home/ramesh/Downloads/mytest/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (/home/ramesh/Downloads/mytest/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/home/ramesh/Downloads/mytest/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.

StarLederer commented 2 years ago

Your project is using a deprecated configuration property. Remove the ndk.dir line from android/local.properties if one is present, and remove it from YOUR_UNITY_EXPORT/local.properties. That will configure the android build to use NDK from your project modules, which is the modern way to configure it.

Edit: Sorry, I got confused myself, the rest of the comment refers to android SDK version, not NDK

In case you get NDK version errors after that: you can change the NDK version in Android Studio under File -> Project Structure -> Modules not under SDK location! Depending on your project you might need to configure it only for the unityLibrary module or the entire app. In case of React Native NDK is configured with an environment variable for the entire app and I would not recommend changing it. Usually you can change the NDK version unityLibrary requires to build in YOUR_UNITY_EXPORT/unityLibrary/build.gradle in


// ...

android {
    // ...

    defaultConfig {
        minSdkVersion 21
        // ...
    }
}

Unity will overwrite this file every time you export unless you remove the comment on line 1 of that file.

Munkhbileg247 commented 2 years ago

Example won't work on windows unless change unity project/built settings/player settings/Other settings /Configuration/IL2CPP to Mono

azesmway commented 2 years ago

Example won't work on windows unless change unity project/built settings/player settings/Other settings /Configuration/IL2CPP to Mono

this plugin is no longer supported use this - https://github.com/azesmway/react-native-unity