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

4

15

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/

Ela answered 21/3, 2021 at 12:58 Comment(1)
Central repository ... central.sonatype.org repo1.maven.org search.maven.org ...Erickaericksen
E
12

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

Ela answered 22/3, 2021 at 12:10 Comment(5)
MvnRepository does not, despite its name, host a Maven repository. Rather, it serves as an information hub aggregated from multiple other repositories. If you use Gradle, for most dependencies, you can just use mavenCentral() instead of jcenter().Fiat
for many libraries there is no host for them in maven central, if you create even a new project without cache, it won't be buildEla
My point is that you can't use MvnRepository as a Maven repository in your Gradle project. You can only look up information in a browser. What you can normally do is to add mavenCentral, and for those (in my experience very few) dependencies that are in other repositories, you add those where needed. And if you are in doubt about what repository a given library has been uploaded to, MvnRepository can usually help you.Fiat
yes, you are right, I updated the answer, and will update it when new repository deployedEla
You still only need mavenCentral(). The other URL you have is the old one for Maven Central.Fiat
G
3

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. 
    }
}
Gravitation answered 16/9, 2021 at 14:20 Comment(0)
S
0

In my case, strangely, all I needed to do was restart my computer.

Samadhi answered 23/12, 2023 at 1:3 Comment(0)
K
-1

Just found the issue and change to mavenCentral.

Kampong answered 16/9, 2021 at 10:41 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.