jitpack.io android-pdf-viewer-2.8.2.pom 401 Unauthorized

See original GitHub issue

Describe 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?

image

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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
rumaxcommented, Oct 21, 2021

I’m not sure what you mean by “do you have jcenter repository”. Do I need to install something?

@tylerforsythe I mean in your gradle script you should have jcenter() defined in repositories for allprojects

allprojects {
    repositories {
        ...
        google()
        jcenter() // <<----- THIS one
    }
}

For example in demo project it is defined as https://github.com/rumax/react-native-PDFView/blob/master/demo/android/build.gradle#L36

401 you get because one of the repositories you use (jitpack) requires authentication. I think you can remove that repo if you cannot access it

0reactions
tylerforsythecommented, Oct 21, 2021

@tylerforsythe I mean in your gradle script you should have jcenter() defined in repositories for allprojects

For example in demo project it is defined as https://github.com/rumax/react-native-PDFView/blob/master/demo/android/build.gradle#L36

@rumax This seems to be the ticket. I was missing the jcenter() line entirely.

401 you get because one of the repositories you use (jitpack) requires authentication. I think you can remove that repo if you cannot access it

Right. The reason I opened the ticket here is because the 401 was for android-pdf-viewer-2.8.2.pom, which is from/related-to this project. 😃 Adding jcenter() to allprojects has somehow resolved it. So I think I’m good to go for now. Today, after re-adding react-native-view-pdf@0.11.1, I was able to build for my Android device and simulator.

Thanks for your patience and assistance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

401 from public repository · Issue #4039 · jitpack/jitpack.io
Getting a 401 unauthorised error on a public repo. This is not isolated to just this one repo as it happens with a...
Read more >
FAQ - JitPack.io
Possible reasons: 1. 404 - File not found. Build failed, tag does not exist or there is no such file in build artifacts....
Read more >
Jitpack Received status code 401 from server: Unauthorized
Issue: Receiving error 401 while resolving dependency of a private repo although my subscription status is Active.
Read more >
jitpack/jitpack.io - Gitter
This repository has a dependency on another jitpack distribution. ... @jitpack-io Received status code 401 from server: Unauthorized.
Read more >
Jitpack.io requiring Auth
Received status code 401 from server: Unauthorized. Seems that jitpack.io started requiring authorization yesterday afternoon.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found