azesmway / react-native-unity

MIT License
268 stars 63 forks source link

android Build failed #63

Open kuzhi10 opened 1 year ago

kuzhi10 commented 1 year ago

Just installing this module is failing to build as shown below. Does anyone know why?

image

Melekhin commented 1 year ago

Just installing this module is failing to build as shown below. Does anyone know why?

image

Hello! Need more information, full logs in process build

thefrankk commented 1 year ago

Any news about that? I have the same error, I only installed the module and tried to compile and gave me the same error.

Melekhin commented 1 year ago

Any news about that? I have the same error, I only installed the module and tried to compile and gave me the same error.

@thefrankk What's the problem? need some more info that might help you (full log in build)

utof commented 1 year ago

i have an identical issue, but even if i make a clean react-native project, and connect my android. Hence i make a conclusion that it isn't related to this library, but rather android setup, but idk why it doesnt work, i think i followed everything on this page... upd: idk how, but restarted my pc, still didnt work, then deleted test project, made a new one, and suddenly it worked...

also maybe this will help. similar issue, some solutions

utof commented 1 year ago

coming back to the project setup given in readme.md, i have the same error still(maybe i screwed something up but idk)

here's the build error ``` (base) PS C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp> npx react-native run-android info Starting JS server... info Installing the app... > Configure project :app WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats. > Configure project :azesmway_react-native-unity WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats. > Configure project :unityLibrary WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats. WARNING:The specified Android SDK Build Tools version (30.0.2) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.3.1. Android SDK Build Tools 30.0.3 will be used. To suppress this warning, remove "buildToolsVersion '30.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. > Task :app:processDebugMainManifest FAILED See http://g.co/androidstudio/manifest-merger for more information about the manifest merger. Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings 25 actionable tasks: 2 executed, 23 up-to-date C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\android\app\src\debug\AndroidManifest.xml Error: uses-sdk:minSdkVersion 21 cannot be smaller than version 22 declared in library [:unityLibrary] C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\unity\builds\android\unityLibrary\build\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 22, or use tools:overrideLibrary="com.unity3d.player" to force usage (may lead to runtime failures) FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 22 declared in library [:unityLibrary] C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\unity\builds\android\unityLibrary\build\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 22, or use tools:overrideLibrary="com.unity3d.player" to force usage (may lead to runtime failures) * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: java.lang.StackOverflowError (no error message) * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== * Get more help at https://help.gradle.org BUILD FAILED in 9s 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.bat app:installDebug -PreactNativeDevServerPort=8081 C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\android\app\src\debug\AndroidManifest.xml Error: uses-sdk:minSdkVersion 21 cannot be smaller than version 22 declared in library [:unityLibrary] C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\unity\builds\android\unityLibrary\build\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 22, or use tools:overrideLibrary="com.unity3d.player" to force usage (may lead to runtime failures) FAILURE: Build completed with 2 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 22 declared in library [:unityLibrary] C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\unity\builds\android\unityLibrary\build\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 22, or use tools:overrideLibrary="com.unity3d.player" to force usage (may lead to runtime failures) * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: java.lang.StackOverflowError (no error message) * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. ============================================================================== * Get more help at https://help.gradle.org BUILD FAILED in 9s at makeError (C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9) at C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async runOnAllDevices (C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7) at async Command.handleAction (C:\Users\ilyab\Documents\0000important - utof proj and files\xrnote\everclon-app\myapp\node_modules\@react-native-community\cli\build\index.js:108:9) info Run CLI with --verbose flag for more details. ```

@Melekhin help pls 😄

edit: tried to just build solely unity project, and run on android - all good. i will try to just run the example that is presented in the repo. edit2: in [root_proj_dir]/android/build.gradle , setting gradle version to 4.2.2, and changing minsdk version the same as in in [root_proj_dir]/unity/builds/android/unityLibrary/build.gradle solved the problem for me.

Luluno01 commented 1 year ago

The direct cause is auto-linking. See https://github.com/azesmway/react-native-unity/issues/51#issuecomment-1500770597.