Can't build, 502 error
What react-native version are you using?
0.66.4
What react-native-pdf version are you using?
6.3.0
What platform does your issue occur on? (android/ios/both)
android
Describe your issue as precisely as possible :
Since today I am unable to build anymore. The below error appears on the log file.
- What went wrong: A problem occurred configuring project ':react-native-pdf'.
Could not resolve all artifacts for configuration ':react-native-pdf:classpath'. Could not resolve com.android.tools.build:gradle:3.1.4. Required by: project :react-native-pdf > Could not resolve com.android.tools.build:gradle:3.1.4. > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'. > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'. Received status code 502 from server: Bad Gateway
Join a screenshot or video of the problem on the simulator or device?
Show us the code you are using?
It's because jcenter() is deprecated.
I don't use the jcenter in my build.gradle file.
it's in your node_modules/react-native-pdf/android/build.gradle file. Change jcenter() to mavenCentral() and apply it with patch-package
I am building through the appcenter, so there is no node modules folder locally, and as far as I know, the appcenter is doing a clean installation on every new build. In addition, I've changed the node version in the appcenter, in order to initiate a clean build. The issue still remains, however.
If you don't have access to node_modules then I can't help you :( This is the only fix I'm aware of.
I am building through the appcenter, so there is no node modules folder locally, and as far as I know, the appcenter is doing a clean installation on every new build. In addition, I've changed the node version in the appcenter, in order to initiate a clean build. The issue still remains, however.
Hello, Im compiling too in App Center and the answer @damian-balas worked for me
In my code I access the node_modules, made the change suggested by him and then run the npx patch-package react-native-pdf then commiting the new file to the repo and compiling again on App Center
We are seeing this error too ever since we upgraded to RN 0.66.4 and removed jcenter() from our build.gradle repositories (replacing it with mavencentral). In the meantime, we should be able to fix this by adding jcenter() back in our app's build.gradle, but this repo should probably move its build.gradle over to mavencentral.
Oops, my last comment wasn't entirely correct. This repo already moved over from jcenter to mavencentral: https://github.com/wonday/react-native-pdf/pull/606
It just hasn't been included in a release yet.
@ericMaxon Thanks, bro. you saved me!
I think maybe an easier solution for y'all than manually editing your node_modules might be to just point your package.json at the latest git commit for this repo instead of the latest release. Just my two cents, hope it helps 🙂
Can I suggest re-opening this until a new version of react-native-pdf that contains https://github.com/wonday/react-native-pdf/pull/606 has been released?
cc @wonday – JCenter did another brownout (as expected per their shutdown plans) and builds failed for a bunch of Android apps that use react-native-pdf. Can you release a new version of this package with https://github.com/wonday/react-native-pdf/pull/606 in it? Also, thank you for the excellent library! ❤️
@wonday Pls push new release, community needs this update like said @nchase. Also thanks for you work!
Please update this PR when the release with #606 is out.
For now what we can do:
- Go to
node_modules/react-native-pdf/android/build.gradle - Change
jcenter()tomavenCentral() - Use patch package to make sure it updates after every install:
npx patch-package react-native-pdf - Git add, commit and push
Notes:
- Add
--use-yarntopatch-packagecommand in case your project uses Yarn. - In case of dependencies are not added to Maven, here is instructions on how to add: https://maven.apache.org/repository/guide-central-repository-upload.html