jcenter Returns Error 403 Forbidden, what should we use instead?
11,400
Solution 1
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
Solution 2
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.
}
}
Author by
Amir Hossein Ghasemi
Updated on July 25, 2022Comments
-
Amir Hossein Ghasemi almost 2 years
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?
-
Bjørn Vester about 3 yearsMvnRepository 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 ofjcenter()
. -
Amir Hossein Ghasemi about 3 yearsfor many libraries there is no host for them in maven central, if you create even a new project without cache, it won't be build
-
Bjørn Vester about 3 yearsMy 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 addmavenCentral
, 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. -
Amir Hossein Ghasemi about 3 yearsyes, you are right, I updated the answer, and will update it when new repository deployed
-
Bjørn Vester about 3 yearsYou still only need
mavenCentral()
. The other URL you have is the old one for Maven Central.