Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jcenter Returns Error 403 Forbidden, what should we use instead?

Seems jcenter service does not work at all and returns 403 Forbidden and also deprecated in IntelliJ products (Like Android Studio)

What should be used instead?

https://jcenter.bintray.com/

like image 863
Amir Hossein Ghasemi Avatar asked Mar 21 '21 12:03

Amir Hossein Ghasemi


People also ask

What can I use instead of JCenter?

Migrating your app away from JCenter can be done by replacing all jcenter() references with mavenCentral() and adding explicit inclusions for dependencies that haven't migrated yet. For your published libraries, try to migrate as soon as possible, and don't forget to also migrate all existing artifacts.

Can I still use JCenter?

Summary: After February 1st, 2022 jcenter() will not work anymore. According to this Gradle blog post: Gradle 7.0 will deprecate the use of jcenter() to resolve dependencies. You will still be able to use JCenter as a repository, but Gradle will emit a warning.

How do I change JCenter to mavenCentral?

To do so, you must simply add mavenCentral() in your build. gradle file. Make sure to put mavenCentral() before JCenter so that the build script takes the up-to-date versions on mavenCentral in priority.

What does the HTTP error 403 mean?

When you encounter this error message, you are basically trying to reach an address or a website that is forbidden to access. Here are examples of some these errors that are commonly thrown: Forbidden: You don't have permission to access [directory] on this server HTTP Error 403 – Forbidden

How to fix 403 Forbidden error in WordPress?

How to Fix the 403 Forbidden Error . Check for URL errors and make sure you're specifying an actual web page file name and extension, not just a directory. Most websites are configured to disallow directory browsing, so a 403 Forbidden message when trying to display a folder instead of a specific page, is normal and expected.

What does 403 Forbidden mean on Lifewire?

He's been writing about tech for more than two decades and serves as the VP and General Manager of Lifewire. The 403 Forbidden error is an HTTP status code that means that accessing the page or resource you were trying to reach is absolutely forbidden for some reason.

What does the error message 401 Unauthorized mean?

The error message could mean that you need additional access before you can view the page. Typically, a website produces a 401 Unauthorized error when special permission is required, but sometimes a 403 Forbidden is used instead.


Video Answer


2 Answers

After many investigating I found some suitable repositories, you can use

mavenCentral()

instead of

jcenter()

And also you need to check your connection and Proxy if you use

like image 59
Amir Hossein Ghasemi Avatar answered Nov 15 '22 00:11

Amir Hossein Ghasemi


Today 16-09-2021 our flutter pipeline stopped working for no apparent reason.

I had to update some gradle versions, and then I ran into this issue: Could not resolve io.flutter:flutter_embedding_debug and Read timed out

Error log:

    [        ] "Install Android SDK Platform 30 (revision: 3)" complete.
    [        ] "Install Android SDK Platform 30 (revision: 3)" finished.
    [+1706 ms] FAILURE: Build failed with an exception.
    [        ] * What went wrong:
    [        ] Could not determine the dependencies of task ':app:processDebugResources'.
    [        ] > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
    [        ]    > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-05e680e202af9a92461070cb2d9982acad46c83c.
    [        ]      Required by:
......
    [        ]       > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-05e680e202af9a92461070cb2d9982acad46c83c.
    [        ]          > Could not get resource 'https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-05e680e202af9a92461070cb2d9982acad46c83c/flutter_embedding_debug-1.0.0-05e680e202af9a92461070cb2d9982acad46c83c.pom'.
    [        ]             > Could not GET 'https://jcenter.bintray.com/io/flutter/flutter_embedding_debug/1.0.0-05e680e202af9a92461070cb2d9982acad46c83c/flutter_embedding_debug-1.0.0-05e680e202af9a92461070cb2d9982acad46c83c.pom'.
    [        ]                > 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
    [        ] BUILD FAILED in 3m 11s
    [        ] 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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
    [ +400 ms] Running Gradle task 'assembleDebug'... (completed in 192.0s)
    [   +4 ms] "flutter apk" took 210,111ms.
    [   +4 ms] Gradle task assembleDebug failed with exit code 1
    [        ] 
               #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
               #1      buildGradleApp (package:flutter_tools/src/android/gradle.dart:411:7)
               <asynchronous suspension>
               #2      _AndroidBuilderImpl.buildApk (package:flutter_tools/src/android/android_builder.dart:101:7)
               <asynchronous suspension>
               #3      BuildApkCommand.runCommand (package:flutter_tools/src/commands/build_apk.dart:103:5)
               <asynchronous suspension>
               #4      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
               <asynchronous suspension>
               #5      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1009:27)
               <asynchronous suspension>
               #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #7      AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
               <asynchronous suspension>
               #8      CommandRunner.runCommand (package:args/command_runner.dart:197:13)
               <asynchronous suspension>
               #9      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
               <asynchronous suspension>
               #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #11     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
               <asynchronous suspension>
               #12     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
               <asynchronous suspension>
               #13     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
               <asynchronous suspension>
               #14     run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
               <asynchronous suspension>
               #15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
               <asynchronous suspension>
               #16     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
               <asynchronous suspension>
               #17     runInContext (package:flutter_tools/src/context_runner.dart:73:10)
               <asynchronous suspension>
               #18     main (package:flutter_tools/executable.dart:90:3)
               <asynchronous suspension>
    [   +2 ms] ensureAnalyticsSent: 0ms
    [   +1 ms] Running shutdown hooks
    [        ] Shutdown hooks complete
    [        ] exiting with code 1

The Fix

The fix was updating the buildscript repositories in the build.gradle file. Earlier we used jcenter() but now we have to use mavenCentral() it seems.

buildscript {
    repositories {
        google()
      //jcenter()      // Does not work any more! (Forbidden) 
        mavenCentral() // Repo that works. 
    }

    dependencies {
        // Don't confuse gradle with the Android gradle plugin (Grr)!
        // Android gradle https://developer.android.com/studio/releases/gradle-plugin
        //classpath 'com.android.tools.build:gradle:3.3.1' //flutter 1.17.5
        //classpath 'com.android.tools.build:gradle:3.5.4'  // Flutter 2.0.6 NullSafety
        classpath 'com.android.tools.build:gradle:4.0.0'  // Flutter 2.0.6 NullSafety
        classpath 'com.google.gms:google-services:4.3.3'  // Firebase for Firebase Cloud Messaging (FCM)  Push Notifications on Android. 
    }
}
like image 30
Bo Kristensen Avatar answered Nov 15 '22 00:11

Bo Kristensen