Fix Android build after JCenter sunset

Open
#12 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
android, java, react-native

Research direction

Start with android/build.gradle and reproduce the Android build failure caused by the jcenter() repository declarations. Replace the repository configuration as shown in the issue, then run the Android build to confirm the library builds successfully without JCenter.

Written by the indexing model from the issue text.

Description

I have used patch-package to patch react-native-screen-corner-radius@0.2.3 for the project I'm working on.

Unfortunately, after the sunset of JCenter, the library doesn't build for Android:

FAILURE: Build failed with an exception.

* Where:
Build file '<redacted>/node_modules/react-native-screen-corner-radius/android/build.gradle' line: 7

* What went wrong:
A problem occurred evaluating project ':react-native-screen-corner-radius'.
> Could not find method jcenter() for arguments [] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.

Here is the diff that solved my problem, using this solution:

diff --git a/node_modules/react-native-screen-corner-radius/android/build.gradle b/node_modules/react-native-screen-corner-radius/android/build.gradle
index 48d7647..3178796 100644
--- a/node_modules/react-native-screen-corner-radius/android/build.gradle
+++ b/node_modules/react-native-screen-corner-radius/android/build.gradle
@@ -4,7 +4,8 @@ buildscript {
 
   repositories {
     google()
-    jcenter()
+    mavenCentral()
+    maven { url 'https://jitpack.io' }
   }
 
   dependencies {
@@ -52,7 +53,7 @@ android {
 
 repositories {
   mavenCentral()
-  jcenter()
+  maven { url 'https://jitpack.io' }
   google()
 
   def found = false

This issue body was partially generated by patch-package.

Dominant language
Java
Stars
121
Forks
11
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mrousavy/react-native-screen-corner-radius

All issues in mrousavy/react-native-screen-corner-radius

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.