A problem occurred configuring project ':app'. > compileSdkVersion is not specified

Viewed 2907

For my React native project when I run npx react-native run-android I get this error:

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.2/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where: Build file 'HIDING_MY_PATH_ON_PURPOSE/mobileappname/android/app/build.gradle' line: 126

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

HIDING_MY_PATH_ON_PURPOSE/mobileappname/android/app/release.properties (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.

  • 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 1s

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

As there are two errors so for the first one I went to app/build.gradle and this is line 126

enter image description here

I've never changed anything in this file, this is how as default it has been created from start.

The java --version I'm using is:

openjdk version "1.8.0_242-release"
OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
OpenJDK 64-Bit Server VM (build 25.242-b3-6915495, mixed mode)

And in my ~/.bash_profile I've added these at the end:

enter image description here

Finally in my android studio's SDK Platform I've Android 10.0 (Q) selected and have all of these SDK Tools installed:

enter image description here

I've followed many things from the answers but still haven't been able to run the app on an Android emulator.

1 Answers

I was missing the release.properties file. I added the file in android/app/ folder and now it's working.

Related