This question already has answers here:
React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0
(4 answers)
Closed 4 months ago.
For some reason, Im getting this issue (build was working fine yesterday):
When I run npx react-native run-android
Im getting:
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Execution failed for task ':expo-modules-core:compileDebugKotlin'.
In terminal im also seeing this:
Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1.
I've seen some solutions online like this. So iv added the kotlin version 1.4.1 and im getting this error when I gun gradle clean:
* What went wrong:
A problem occurred configuring root project 'ProjectName'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.4.1/kotlin-gradle-plugin-1.4.1.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.4.1/kotlin-gradle-plugin-1.4.1.pom
- https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.4.1/kotlin-gradle-plugin-1.4.1.pom
Required by:
project :
Not sure why this build has started failing. any ideas?
Check out
https://github.com/facebook/react-native/issues/35210
On November 4th 2022 a new React Native version got published which is causing some build issues.
This event resulted in build failures for Android on several users as they ended up downloading the wrong React Native version (0.71.0-rc0 instead of the version they were using in their project, say 0.68.0).
have you initiated your projects with "expo init" command or by using npx?
Related
I have upgraded React Native from version 0.68.1 to version 0.70.2, and react from 17.0.2 to 18.1.0. That has worked fine, but I have also upgraded Android Studio to version 2021.3.1. I updated configuration files with the React Native CLI, npx react-native upgrade. Then I attempted to upgrade the android directory according to the React Native Upgrade Helper and manual edits that are necessary to sign an android app. That failed, so I have tried a backup copy but now that fails too despite the fact that the android directory is unchanged from when the app was building correctly. I used Git to revert to a known working copy.
I don't see any procedures to upgrade the Android files after upgrading Android Studio from React Native. Is there any available guidance for the version of Android Studio I use? How can I upgrade the Android project to get it to build with the new version of Android Studio? I'm guessing that Gradle versioning has a lot to do with the errors but I haven't found any explanation or advice to upgrade the project after upgrading Android Studio.
The error I get from PowerShell after running .\gradlew bundleRelease is
Task :app:signReleaseBundle FAILED
w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
> java.lang.OutOfMemoryError (no error message)
When I open the Android folder in Android Studio I notice errors in MainApplication.java and AsyncStoragePackage.java: Cannot resolve symbol 'BuildConfig'. Invalidating the cache, clean, and rebuild have not changed the results.
The answer was found earlier on GitHub. In my instance, there are other messages and the relevant error message is Detected multiple Kotlin daemon sessions at build\kotlin\sessions. Simply adding the code to android/build.gradle as follows fixed the issue for me. I expect the version will need to be updated periodically and I'm now sure how to get the version info as my Kotlin REPL will not start.
belbuildscript {
ext {
// ...
kotlin_version = '1.6.10' // <- add this line
}
dependencies {
// ...
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // <- add this line
// ...
}
}
I'm guessing that this sort of problem can be avoided by uninstalling Android Studio before installing a more recent version, and other software may need the same treatment.
I cant build my app in react native. I started building with cleand project and sync gradle. Everything is okay but when i started building i get The error: "Cause: Argument type mismatch". There is no more description or location where is this error.
Img of the error
What helped me is to downgrade gradle from 7 to 6.9. You can do that in File->Project structure.
reference:
(React Native): Execution failed for task ':app:generatePackageList'
I'm hitting a build issue with a fresh react-native init project (RN 0.57.2) when starting up with react-native run-android:
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find support-annotations.jar (com.android.support:support-annotations:27.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-annotations/27.1.1/support-annotations-27.1.1.jar
What could possibly be wrong here? Is my Android Support Library version installed by Android Studio wrong?
I'm running Android Studio 3.1.0.0 on WIN10, yarn version 1.10.1.
Hi I'm just starting to learn how to code on android studio.
After running npm run android on my terminal, I've faced some errors which I could not solve.
The error message is as follows :
XXXX-MacBook-Pro:first-app XXXX$ npm run android
first-app#0.1.0 android /Users/XXXX/Desktop/React Native/first-app
react-native run-android
Scanning folders for symlinks in /Users/XXXX/Desktop/React
Native/first-app/node_modules (8ms) Starting JS server... Building and
installing the app on the device (cd android && ./gradlew
installDebug)...
FAILURE: Build failed with an exception.
What went wrong: Could not resolve all files for configuration
':app:_internal_aapt2_binary'. Could not find
com.android.tools.build:aapt2:3.2.0-4818971. Searched in the
following locations:
file:/Users/XXXX/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/Users/XXXX/Library/Android/sdk/extras/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar
file:/Users/XXXX/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/Users/XXXX/Library/Android/sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar
file:/Users/XXXX/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/Users/XXXX/Library/Android/sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar
file:/Users/XXXX/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/Users/XXXX/.m2/repository/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
https://jcenter.bintray.com/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar
file:/Users/XXXX/Desktop/React Native/first-app/node_modules/react-native/android/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971.pom
file:/Users/XXXX/Desktop/React Native/first-app/node_modules/react-native/android/com/android/tools/build/aapt2/3.2.0-4818971/aapt2-3.2.0-4818971-osx.jar
Required by:
project :app
BUILD FAILED in 3s 11 actionable tasks: 1 executed, 10 up-to-date
Could not install the app on the device, read the error above for
details.
I hope you guys can help me with it.
I managed to fix this issue by adding a line google() to ~/my-app/android/build.gradle in the following section:
allprojects {
respositories{
google() //right here
}
}
Just a guess, but I believe it is a regression to do with the new Android Studio 3.2.0 release.
This is in react native which in fact i never used, this isn't an answer but i cant comment as my reputation is too low for that(pardon me). Have you installed android build tools? The ':app:_internal_aapt2_binary' is a configuration file that the system needs to compile the application which is a part of build tools.
If you are using android studio 3.0, then in gradle , change the dependency from
compile files('xyz')
to
implementation files('xyz')
I am currently trying to build and run my project on android but it keeps failing. I followed all the instructions for setting up the android environment correctly, as I am able to get my other applications to work on the simulator. I am using the React native maps dependency on this project, and for some reason whenever I run react-native run-android it crashes with this error:
error: constructor ActionSheetPackage in class ActionSheetPackage cannot be applied to given types;
new ActionSheetPackage()
^
required: FragmentActivity
found: no arguments
reason: actual and formal argument lists differ in length
1 error
:app:compileDebugJavaWithJavac FAILED
Followed by:
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
I've tried troubleshooting using what can be found on the react-native-maps github page, and none of that seems to work. Does anyone have any ideas?
It turns out that the issue was that there was a dependency that did not work on android. When I npm installed the dependency it also installed it's self in the android portion of the project. Once I removed it from there it worked like a charm.