【发布时间】:2021-10-23 17:50:20
【问题描述】:
mavenCentral() 不工作,而不是 jcenter()。当我使用 mavenCentral() 时,我收到以下错误消息,
Could not HEAD 'https://google.bintray.com/flexbox-layout/com/google/android/flexbox/2.0.1/flexbox-2.0.1.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project
使用上面的 jcenter() 不会出现错误。
即使在不推荐使用 jcenter() 之后,我也可以在我的项目中使用 jcenter()。在我们的项目中使用 jcenter() 的最后日期是什么时候。
项目 build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.3'
classpath 'com.google.gms:google-services:4.3.8'
//classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.4"
}
}
allprojects {
/*apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'*/
repositories {
google()
mavenCentral()
}
}
模块 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
defaultConfig {
applicationId "io.kommunicate.app"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//Sensitive data
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
repositories {
google()
mavenCentral()
//jcenter()
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//api project(':kommunicateui')
implementation 'io.kommunicate.sdk:kommunicateui:2.1.8'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.multidex:multidex:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
可以发一下
build.gradle吗? -
@Skizo-ozᴉʞS 我添加了 app build.gradle。请看。
-
你能保持 jcenter() 吗?仍然有一些 api 需要它。两者都保留。
-
请同时添加您的项目的 build.gradle,而不是应用程序
-
如果您的国家/地区受到 google 制裁(403:禁止),请使用 vpn
标签: android deprecated jcenter