Execution failed for task ':react-native-agora:compileDebugJavaWithJavac' - react-native

i have tried npx react-native start run android
i got this Execution failed for task.and i remove node module and lock file than reinstall(npm) same error.and also i removed agora file after i add npm i react-native-agora. that time same compileDebugJavaWithJavac with different dependencies(example react-native-image-crop-picker:compileDebugJavaWithJavac ) than i try same way to remove and add npm i got another error(react-native-agora:compileDebugJavaWithJavac)
error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-agora:compileDebugJavaWithJavac'.
> Failed to query the value of task ':react-native-agora:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
> Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /home/ubuntu/Desktop/quaquiz/node_modules/react-native-agora/android/build/generated/ap_generated_sources/debug/out))) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer#49f0db11) before task ':react-native-agora:compileDebugJavaWithJavac' has completed is not supported
build gradle:
uildscript {
ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "17.0.0"
}
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:3.6.1')
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
here i increased sdk version 30 after i got all this error.
before i using build gradle
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29

See if this help
cd android && ./gradlew clean && cd ..

Probability, it's gradle incompatible. set gradle in dependencies to
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2')
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

Related

Getting an error with react-native-safe-area-context build.gradle file and compileSdkVersion is not specified

I am getting this Error message while building my react native project.
BUILD FAILED in 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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\sawan\OneDrive\Desktop\Unsplash\app\node_modules\react-native-safe-area-context\android\build.gradle' line: 28
* What went wrong:
A problem occurred evaluating project ':react-native-safe-area-context'.
> Could not initialize class org.jetbrains.kotlin.gradle.plugin.KotlinGradleBuildServices
* 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 ':react-native-safe-area-context'.
> com.android.builder.errors.EvalIssueException: 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.
==============================================================================
Its saying error is in this file:
C:\Users\sawan\OneDrive\Desktop\Unsplash\app\node_modules\react-native-safe-area-context\android\build.gradle
//rest of the code ...
android {
compileSdkVersion getExtOrDefault('compileSdkVersion', 30)
// Used to override the NDK path/version on internal CI or by allowing
// users to customize the NDK path/version from their root project (e.g. for M1 support)
if (rootProject.hasProperty("ndkPath")) {
ndkPath rootProject.ext.ndkPath
}
if (rootProject.hasProperty("ndkVersion")) {
ndkVersion rootProject.ext.ndkVersion
}
defaultConfig {
minSdkVersion getExtOrDefault('minSdkVersion', 16)
targetSdkVersion getExtOrDefault('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
ndk {
abiFilters (*reactNativeArchitectures())
}
}// rest of the code ....
Here is my build.gradle file from \android
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
// kotlin_version = '1.5.20' //
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
// classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") //
}}
Don't know if error is in this path or the build.gradle file

react native otp verify erro generateDebugRFile

Error building android after installing lib. Version RN >= 0.60
Execution failed for task ':react-native-otp-verify:generateDebugRFile'.
> Could not resolve all files for configuration ':react-native-otp-verify:debugCompileClasspath'.
> Could not find com.google.android.gms:play-services-auth:16.1.0.
Required by:
project :react-native-otp-verify
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I also tested by performing the manual linking, but not building too.
android/build.gradle
buildscript {
ext {
minSdkVersion = 21
compileSdkVersion = 32
targetSdkVersion = 32
ndkVersion = "21.4.7075529"
supportLibVersion = "29.0.0"
googlePlayServicesVersion = "16.1.0"
googlePlayServicesIidVersion = "16.0.1"
googlePlayServicesVisionVersion = "15.0.2"
firebaseMessagingVersion = "21.1.0"
}
repositories {
....
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
classpath 'io.fabric.tools:gradle:1.28.1'
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath 'com.google.gms:google-services:4.3.3'
}
android/app/src/buil.gradle
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'com.google.android.gms:play-services-auth:16.0.1'
...
}
Lib -> https://github.com/faizalshap/react-native-otp-verify
Manual linking -> https://github.com/react-native-community/cli/blob/main/docs/autolinking.md
The gradle file shown above is the android/build.gradle. One more gradle file is there inside your android app folder please add implementation 'com.google.android.gms:play-services-auth:16.0.1' inside dependencies of your android/app/build.gradle and try cleaning and rebuilding

Execution failed for task ':realm:stripDebugDebugSymbols'

After installing realm in react native and setting up all necessary things console give me this error after starting project (npm run android);
Execution failed for task ':realm:stripDebugDebugSymbols'. NDK at C:\Users\123\AppData\Local\Android\Sdk\ndk\21.4.7075529 did not have a source.properties file.
I check ndk in android studio (after opening project in it) in Android SDK --> SDK tools sections, the ndk already installed. I also change the ndk version (one by one) in android/build.gradle according to some other stackoverflow solutions but didn't work. Below is android/build.gradle code;
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"//"25.1.8937393"//"21.1.6528147"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
This is a android studio screen shot of sdk tools SDK tools

> Task :app:checkReleaseAarMetadata FAILED - React native

I am making a release build for my project using ./gradlew assembleRelease command but it gives me this error.
> Task :app:checkReleaseAarMetadata FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
> Could not resolve com.facebook.android:facebook-android-sdk:[8,9).
Required by:
project :app
> Failed to list versions for com.facebook.android:facebook-android-sdk.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)
my build.gradle
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
googlePlayServicesAuthVersion = "16.0.1"
}
To solve this issue just change the compileSdkVersion in your build.gradle file.
Open android > build.gradle file.
Change compileSdkVersion from 29 to 30.
Change targetSdkVersion from 29 to 30.
now run again.
To solve this issue just add mavenCentral() in repositories of your project build.gradle.
Refer to https://developers.facebook.com/docs/android/getting-started/

Why am I getting this error in react native?

I am new to react native. When I run react-native run-android I get this error.
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Stay Hungry\app developement\Aarogya\node_modules\react-native-share\android\build.gradle' line: 53
* What went wrong:
A problem occurred evaluating project ':react-native-share'.
> Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on 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.
BUILD FAILED
Total time: 7 mins 24.686 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
I traced the path to the error location and my build.gradle is below:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 27)
buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 27)
versionCode 1
versionName "1.0.0"
}
lintOptions {
abortOnError false
warning 'InvalidPackage'
}
}
repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
jcenter()
}
dependencies {
compileOnly "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '27.1.0')}"
}
I have no idea what is wrong here. I have not even started writing code in app.js yet. I am using a physical device to run the code with an adb device.
The error you are getting is from the library react-native-share.
Did you follow the instructions to installing it right?