jitpack.io android-pdf-viewer-2.8.2.pom 401 Unauthorized
See original GitHub issueDescribe the bug
401 received trying to GET ‘https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom’ during npx react-native run-android.
To Reproduce
Unable to get the demo project to even begin building via npm install or yarn install. So I was unable to get to the run-android step in the sample.
Steps to reproduce the behavior:
rm -rf node_modules
yarn install [or npm install]
npx react-native run-android
Expected behavior That the build successfully pulls any needed react-native-PDFView files.
Screenshots Build log output below. Note the pertinent bit is:
Could not GET 'https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom'.
Received status code 401 from server: Unauthorized
Attempting to access ‘https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom’ directly in a browser prompts for a username and password, which explains the error. It seems like the password prompt shouldn’t be happening. My understanding is that because this is an open source project, the jitpack hosting should be free and open. Perhaps something changed with the host service of this file?

PS C:\home\projects\custom-mobile-app> npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1198 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...
> Configure project :app
WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: project ':react-native-async-storage_async-storage', project ':react-native-screens', project ':react-native-svg', ...
> Task :app:checkDebugAarMetadata FAILED
16 actionable tasks: 2 executed, 14 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.github.barteksc:android-pdf-viewer:2.8.2.
Required by:
> Could not resolve com.github.barteksc:android-pdf-viewer:2.8.2.
> Could not get resource 'https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom'.
> Could not GET 'https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom'. Received status
code 401 from server: Unauthorized
* 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 26s
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 failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.github.barteksc:android-pdf-viewer:2.8.2.
Required by:
project :app > project :react-native-view-pdf
> Could not resolve com.github.barteksc:android-pdf-viewer:2.8.2.
> Could not get resource 'https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom'.
> Could not GET 'https://www.jitpack.io/com/github/barteksc/android-pdf-viewer/2.8.2/android-pdf-viewer-2.8.2.pom'. Received status
code 401 from server: Unauthorized
* 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 26s
at makeError (C:\home\projects\custom-mobile-app\node_modules\execa\index.js:174:9)
at C:\home\projects\custom-mobile-app\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at runOnAllDevices (C:\home\projects\custom-mobile-app\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
at Command.handleAction (C:\home\projects\custom-mobile-app\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
Smartphone (please complete the following information): Samsung SM-G920V (Verizon Galaxy S6)
Additional context Android Studio Arctic Fox 2020.3.1 patch 2 built August 26, 2021 running on Windows 10. Problem seems to be Android-build only. Works fine on my Mac Mini M1 and iOS iPhone 12 Pro. In fact, it runs great on my iOS device – thanks for this awesome package.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Related StackOverflow Question
@tylerforsythe I mean in your gradle script you should have
jcenter()defined inrepositoriesforallprojectsFor example in demo project it is defined as https://github.com/rumax/react-native-PDFView/blob/master/demo/android/build.gradle#L36
401you get because one of the repositories you use (jitpack) requires authentication. I think you can remove that repo if you cannot access it@rumax This seems to be the ticket. I was missing the
jcenter()line entirely.Right. The reason I opened the ticket here is because the
401was forandroid-pdf-viewer-2.8.2.pom, which is from/related-to this project. 😃 Addingjcenter()toallprojectshas somehow resolved it. So I think I’m good to go for now. Today, after re-addingreact-native-view-pdf@0.11.1, I was able to build for my Android device and simulator.Thanks for your patience and assistance!