failed to build react native project - android

I had been able to build and run the react-native project in my old intel based mac successfully. Recently I migrated my project to the apple silicon and now I'm having issues building and running react-native project on m1 mac. When I run the npx react-native run-android I get below error message in the console:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/sussol/Documents/Git/mobile/android/app/build.gradle' line: 120
* What went wrong:
A problem occurred evaluating project ':app'.
> ../package.json (No such file or directory)
* 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:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 2m 4s
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 completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/sussol/Documents/Git/mobile/android/app/build.gradle' line: 120
* What went wrong:
A problem occurred evaluating project ':app'.
> ../package.json (No such file or directory)
* 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:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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
I tried various things to get it working like cleaning gradle, using different build tools versions etc. But none of them worked. Does anybody has any idea what's going on here? Any help would really be appreciated. Thanks.

Related

React-native Project gives A problem occurred evaluating project ':app'

When I am running my react-native app it gives me these errors:
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\malik.usman\Desktop\Malik Usman\React Native Projects\MyApp\android\app\build.gradle' line: 2
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find implementation class 'com.facebook.react.ReactPlugin' for plugin 'com.facebook.react' specified in jar:file:/C:/Users/malik.usman/.gradle/caches/jars-9/20363358361f313985ae969d544ea93f/react-native-gradle-plugin.jar!/META-INF/gradle-plugins/com.facebook.react.properties.
* 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:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 13s
My App Verisons are:
react-native: "0.71.0"
react: "18.2.0"
My newly build react-native project not running.

I'm trying to run emulator on flutter anyone know solving?

FAILURE: Build failed with an exception.
Where:
Build file 'C:\src\Flutter projeleri\dar_t1\flutter_application_1\android\app\build.gradle' line: 27
What went wrong:
A problem occurred evaluating project ':app'.
Could not get unknown property 'stacktrace' for project ':app' of type org.gradle.api.Project.
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

Errors when setting up react native with expo with firebase?

These are the errors when running "npx react-native run-android"
rror 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 completed with 2 failures.
1: Task failed with an exception.
Where:
Script '/home/modou/Desktop/northcoders/projects/test-RN/Bot-Spotter/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle' line: 272
What went wrong:
A problem occurred evaluating project ':expo'.
A problem occurred configuring project ':expo-modules-core'.
Failed to notify project evaluation listener.
> NDK at /home/modou/Android/Sdk/ndk/21.1.6352462 did not have a source.properties file
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
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:
A problem occurred configuring project ':expo'.
compileSdkVersion is not specified. Please add it to build.gradle
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.
==============================================================================

A problem occurred configuring project ':background_locator'

While build the app get an error like
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':background_locator'.
> Could not load compiled classes for build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\background_locator-1.6.12\android\build.gradle' from cache.
* 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 23s
Exception: Gradle task assembleDebug failed with exit code 1
How to solve this issue

Unable to run Flutter Project with Package

I created a new app.
Added audioplayers flutter package from https://pub.dev/packages/audioplayers.
Shows an error from Android Embedding. I followed the instructions https://flutter.dev/go/android-project-migration.
Now I get this error:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\src\flutter\flutter\.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':audioplayers'.
> Plugin with id 'kotlin-android' not found.
* 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:
A problem occurred configuring project ':audioplayers'.
> compileSdkVersion is not specified.
* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Then I followed https://github.com/react-native-webview/react-native-webview/issues/1407 thread to do what suggested.
Now I'm getting this error:
FAILURE: Build failed with an exception.
Where:
Build file 'C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\build.gradle' line: 49
What went wrong:
A problem occurred evaluating project ':audioplayers'.
Could not get unknown property 'kotlin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
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 4s
Exception: Gradle task assembleDebug failed with exit code 1
I'm very new in android studio development, it drives me crazy with these configurations. Thank you very much.
For those who came up with the same problem I have. The project I'm working came from Git and I think that project wasn't updated for Android Embedding v2 so I got the first error.
Now in the second error, all I did was to read other's bug fixes (not officially).
Adding the dependencies and kotlin-version (1.4.20) needed for the main package(audioplayers). C:\flutter\flutter.pub-cache\hosted\pub.dartlang.org\audioplayers-0.17.1\android\
Making the android project's app build.gradle>defaultConfig>minSdkVersion to 23 (from 16)
Use pub get and update in pubspec.yaml.

Categories

Resources