react-native Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml' [duplicate] - android

This question already has answers here:
JCenter deprecation; impact on Gradle and Android
(10 answers)
Closed 4 months ago.
I created build yesterday and it was working fine . but when I try to create the release build today I got this. some if the question that are already asked here
Question No 1:
Question No 2:
These question are specfic to android and new user of react-native can't understand them easily. so thats why i nam asking another question here specific for react-native users.
The question i mentioned above has answer which help in some specific cases but when it comes to react native in some cases it does nit help, like for some of the dependincies in node_modules.
The Above explination is added beacuse the question was marked as duplicate.
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':react-native-community_masked-view:verifyReleaseResources'.
> Could not resolve all task dependencies for configuration ':react-native-community_masked-view:releaseRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-community_masked-view
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Read timed out
* 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
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
BUILD FAILED in 2m 45s
5 actionable tasks: 5 up-to-date
I think the issue is due to jcenter deprecation . any possible solution or alternative of jcenter. this is specific for react-native projects where there are many dependencies and you have to change.

From Hours of research if finally found that. this is an issue due to jcenter is down.
According to official documentation the jcenter depricated and Bintray/JCenter users should start migrating to a new hosting solution.
the solution for this is to remove jcenter from build file and replace it with
mavenCentral() // <- add it
for react-native users jcenter() may be exists in some depedency that you installed recently. to check for jcenter open your project in android-studio to check all build.gradle files easliy.
Another solution for this is that disconnect your system from internet and build your project. after you lanuc your project reconnect your system to internet.

jcenter is down so until it comes online a temporary solution is just to disconnect from the internet and build your project, once the build is complete and the app launches you can connect back.

The problem comes from the shutdown of jcenter. Event if you remove the repository for your app, you'll get errors if some of your declare jcenter().
The best way would be to have PRs merged and version update of those dependencies, but that might take a while.
In the meantime you can add the following in your android/build.gradle :
allprojects {
repositories {
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
remove repo
add(mavenCentral())
}
}
}
...
This fixed all my builds.

The solution from #PhilippeAuriach is fixing it for react-native !
I Added this :
allprojects {
repositories {
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
if (repo.url.toString().startsWith('https://jcenter.bintray.com/')) {
remove repo
add(mavenCentral())
}
}
}
To my android/build.gradle and worked fine after hours of research !
(Thanks #PhilippeAuriach)

Related

Flutter Android build not generating in Mac

In Mac, I've setup Flutter in Android studio. When I'm running project it gives me error
* What went wrong:
Execution failed for task ':location:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
I'm using all latest versions of Flutter, Kotlin, Gradle etc.
You need to equalize kotlin version in first row which is ext.kotlin_version = '1.6.10' to according to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" of underlined $kotlin_version
After this, the problem will solve...
Actually I found a solution for my problem. There are 2 dependency defined in .yaml file 1. geo_location and 2. location.
After removing the location dependency from .yaml file and run command flutter pub get I can successfully build android build from Mac. This solution might not be global but solution of my problem I found this.
Thank you!
Happy coding.

Flutter: Execution failed for task ':agora_rtc_engine:compileDebugKotlin'

I am working on an old project. It worked fine before 5 days ago. Now I am facing an error with agora. I didn't any change on my previous code.
here is error-
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':agora_rtc_engine:compileDebugKotlin'.
> Could not resolve all files for configuration ':agora_rtc_engine:debugCompileClasspath'.
> Could not find native-full-sdk-3.4.6.jar (com.github.agorabuilder:native-full-sdk:3.4.6).
Searched in the following locations:
https://www.jitpack.io/com/github/agorabuilder/native-full-sdk/3.4.6/native-full-sdk-3.4.6.jar
* 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 38s
Running Gradle task 'assembleDebug'... 40.0s
Exception: Gradle task assembleDebug failed with exit code 1
I am using agora_rtc_engine: ^3.3.1 bacause this project developed without null-safety (maybe flutter 1.5). How can I solve this problem ?
1.Run flutter upgrade in the terminal to upgrade Flutter
2.Run dart migrate to run the dart migration tool
3.Solve all errors which the migration tool shows
4.Run flutter pub outdated --mode=null-safety to print all outdated packages
5.Run flutter pub upgrade --null-safety to upgrade all packages automatically
6.Check the code for errors and solve them
7.Run dart migrate again and it should now be successful. Follow the link to checkout the proposed changes
8.Press the "Apply Migration" button
9.Check the code for errors again and fix them.
Run flutter run in the command line and the application should run...
Note: If there are any library in you project that don't support null safety you must need to upgrade that library. if that library don’t have null safety remove the library and use another library
So you have to migrate your project to null-safety first and then get
agora_rtc_engine: ^4.2.2
Then you to to your build.gradle and add that last line
allprojects {
repositories {
google()
jcenter()
// add this line.
maven { url ‘https://www.jitpack.io' }
}
}
Because following this issue here on GitHub there is no solution for it because this issue has been closed on the agora project.
For anyone who is still facing this issue
1: Run flutter pub outdated --mode=null-safety to check which dependencies are outdated
2: Run flutter pub upgrade --null-safety to upgrade all dependencies
3: It would update agora_rtc_engine to latest sdk, try to change that to agora_rtc_engine: 4.2.2
4: Set ext.kotlin_version = '1.6.10' in *build.gradle
Note: If you face any incompatibility with other packages for setting minSdk as 19, change minSdk to 19
5: If you faced any gradle error, you might need to change gradle-wrapper.properties
//add this line
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.1-all.zip
Thats all

Gradle searching at wrong URL for 'io.nano:android-tex:1.0.0'

I cannot start my Android App if it includes the following line in the dependencies of the module level build.gradle file:
dependencies{
...
implementation 'io.nano:android-tex:1.0.0'
...
}
The gradle sync works without errors.
But when I try to start the app, I get the error that io.nano:android-tex:1.0.0 cannot be found. Here is a part of the error log:
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find io.nano:android-tex:1.0.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/nano/android-tex/1.0.0/android-tex-1.0.0.pom
- https://repo.maven.apache.org/maven2/io/nano/android-tex/1.0.0/android-tex-1.0.0.pom
Required by:
project :app
It seems to me that the URLs are simply wrong. https://repo.maven.apache.org/maven2/io/nano/android-tex/1.0.0/android-tex-1.0.0.pom does not lead to anywhere useful.
But the library exists on maven (see here: https://mvnrepository.com/artifact/io.nano/android-tex/1.0.0).
Is my gradle not smart enough to search at the right place?
A couple of months ago, I successfully used 'io.nano:android-tex:1.0.0' in a project. But after updating Android Studio to Bumblebee and updating gradle from 7.0.2 to 7.2, it does not work anymore. (I don't know if those upgrades are the reason, though, because it has been months since I had worked on the project the last time).
Can anyone help with this? I just want to find a way to use 'io.nano:android-tex:1.0.0' again in an Android App.
--- EDIT ---
I have also added jcenter to my repositories in my project level gradle file (to check if that makes a difference):
repositories {
google()
mavenCentral()
jcenter()
}
Unfortunately, that does not help.
from github site:
Library is available in jcenter repository, add this script to your build.gradle file to install:
you should add jcenter() to your libs repository, but remember that jcenter is kind-of deprecated. ask lib author for moving to more reliable repository

Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

I am trying to build my react-native project for android and getting the following error on Windows but its working on Mac.
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1090 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Task :react-native-get-sms-android:generateDebugRFile FAILED
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.9/userguide/command_line_interface.html#sec:command_line_warnings
128 actionable tasks: 128 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-get-sms-android:generateDebugRFile'.
> Could not resolve all files for configuration ':react-native-get-sms-android:debugCompileClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-get-sms-android
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
* 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 24s
My Environment:
Windows 10 Home
React Native v66.4
NodeJS v12.18.1
Found solutions when googled about this error that bintray was down and its status could be tracked at https://status.bintray.com.
But building the project works fine on Mac environment, and at the same time, it is failing in Windows with Received status code 502 from server: Bad Gateway. Any clues on this weird behavior?
If Osvaldo's solution doesn't work, another one is to update your dependency itself which relies on jcenter in its gradle at the current version.
In this case, it's react-native-get-sms-android. Updating it may free it from jcenter.
In my case, it was an old version of react-native-sqlite-2.
I had the same issue nad removing jcenter and adding maven solved my problem:
The android/build.gradle file:
repositories {
+ mavenCentral()
google()
- jcenter()
gradlePluginPortal()
}
~ ~ ~
dependencies {
~ ~ ~
+ mavenCentral()
google()
- jcenter()
+ gradlePluginPortal()
maven { URL 'https://www.jitpack.io' }
}
Hint: The + sign means add this line and the - means remove that line.
Hot news
Yesterday morning jcener was shutdown by Facebook, so in one of my cases because issue was inside a package in node_modules folder, I used the following solution instead of above to permanently remove whatever related to jcenter:
The android/build.gradle file of that package in node_modules folder:
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://jcenter.bintray.com/')) {
remove repo
}
}
}
To keep this node_modules changes in the production environment use patch-package.

Could not resolve all dependencies for configuration ':androidRuntimeNoRetrolambdaCopy'. Could not find com.android.support:multidex:1.0.1

After Run /gradle Android to deploy the Gluon app in my Android Phone. I have this error:
org/controlsfx/control/spreadsheet/SpreadsheetColumn$$Lambda$1
Saving lambda class: org/controlsfx/control/textfield/TextFields$$Lambda$1
:mergeClassesIntoJar
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture snapshot of input files for task 'mergeClassesIntoJar' during up-to-date check.
> java.io.FileNotFoundException: /Users/yotti/Library/Android/sdk/extras/android/support/multidex/library/libs/android-support-multidex.jar (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.
After update the JFXPlugin like in the Image ,i have this error
A problem occurred configuring root project 'SingleViewProject'.
Could not resolve all dependencies for configuration ':androidRuntimeNoRetrolambdaCopy'.
Could not find com.android.support:multidex:1.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/multidex/1.0.1/multidex-1.0.1.pom
https://jcenter.bintray.com/com/android/support/multidex/1.0.1/multidex-1.0.1.jar
https://oss.sonatype.org/content/repositories/snapshots/com/android/support/multidex/1.0.1/multidex-1.0.1.pom
https://oss.sonatype.org/content/repositories/snapshots/com/android/support/multidex/1.0.1/multidex-1.0.1.jar
Required by:
:SingleViewProject:unspecified
It was already mentioned in this question, Android obsolete library Android Support Library is no longer available.
Using jfxmobile plugin version 1.3.1 solves the issue, as it uses the multidex library that should be found here: ANDROID_HOME/extras/android/m2repository/com/android/support/multidex/1.0.1/multidex-1.0.1.aar.
Note you need to install with the Android SDK Manager both Extras/Google Repository and Extras/Android Support Repository.
Also is advisable to create a properties file with the ANDROID_HOME variable, under /Users/<user>/.gradle/gradle.properties:
ANDROID_HOME=/Users/yotti/Library/Android/sdk
and remove the line in the build.gradle -> jfxmobile -> android -> androidSdk.
As for the Charm dependencies you are using the wrong repository, you need:
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
Finally, you don't show a ControlsFX dependency, so it is not possible to have the exception posted in the first place.

Categories

Resources