Android Gradle 同步失败找不到支持核心-ui.aar
Android Gradle Sync failed could not find support-core-ui.aar
我已经在这个Android项目上工作了大约一年,昨天我打开它时突然AndroidStudio 3.1.2无法同步gradle和项目不再构建给我这个错误:
Could not find support-core-ui.jar (com.android.support:support-core-ui:27.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-core-ui/27.1.1/support-core-ui-27.1.1.jar
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager
我很确定 Android 支持存储库安装正确,因为它在其他项目中运行成功,我的所有其他项目都运行良好,没有任何问题。
我在应用程序模块中有这个 gradle 文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
}
}
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'realm-android'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 32
versionName "3.1"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id : "",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
if (requested.group == 'com.google.android.gms') {
details.useVersion '15.0.1'
}
if (requested.group == 'com.google.firebase') {
details.useVersion '15.0.1'
}
}
}
buildTypes {
release {
minifyEnabled false
// proguardFiles 'proguard.cfg'
}
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
}
}
repositories {
maven {
url "https://jitpack.io"
}
maven {
url "https://dl.bintray.com/lukaville/maven"
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
mavenCentral()
}
dependencies {
compile project(':FORTSDKv1.4.1')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/gcm.jar')
compile files('libs/httpclient-4.3.4.jar')
compile files('libs/httpmime-4.2.5.jar')
compile files('libs/HockeySDK-3.0.2.jar')
compile files('libs/samsungpay-1.8.00.jar')
compile project(':library-2.4.1')
// Required for geotagging
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
compile('com.code-troopers.betterpickers:library:3.1.0') {
exclude group: 'com.nineoldandroids', module: 'library'
}
compile 'com.android.support:support-v4:27.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-core-ui
compile group: 'com.android.support', name: 'support-core-ui', version: '27.1.1'
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'com.android.support:customtabs:27.0.0'
compile 'com.android.support:multidex:1.0.3'
compile 'com.googlecode.libphonenumber:libphonenumber:8.8.9'
compile 'org.parceler:parceler-api:1.1.5'
compile('com.google.android.gms:play-services-analytics:11.8.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
// compile 'com.google.android.gms:play-services-analytics:11.8.0'
compile 'com.github.hackware1993:MagicIndicator:1.5.0'
compile 'com.roomorama:caldroid:2.3.1'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.leocardz:aelv:1.1@aar'
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile('com.jakewharton:butterknife:8.4.0') {
exclude module: 'support-compat'
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.jrvansuita:IconHandler:+'
compile 'com.github.mancj:SlideUp-Android:2.2.5'
compile 'com.afollestad:sectioned-recyclerview:0.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile 'com.uphyca:stetho_realm:2.0.0'
compile 'org.greenrobot:eventbus:3.1.1'
compile 'com.birbit:android-priority-jobqueue:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.valdesekamdem.library:md-toast:0.8.0'
compile 'com.facebook.android:account-kit-sdk:4.30.0'
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile 'com.wang.avi:library:2.1.3@aar'
compile 'com.afollestad.material-dialogs:core:0.9.6.0'
// compile 'com.onesignal:OneSignal:3.6.5'
compile 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
compile 'com.kbeanie:image-chooser-library:1.6.0@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.scalified:fab:1.1.3'
compile 'com.github.traex.expandablelayout:library:1.2.2'
compile 'com.github.markomilos:paginate:0.5.1'
compile 'com.wdullaer:materialdatetimepicker:3.3.0'
compile 'com.github.tamir7.contacts:contacts:1.1.7'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.github.livechat:chat-window-android:v2.0.0'
compile 'com.uber.sdk:rides-android:0.6.1'
compile 'link.fls:swipestack:0.3.0'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.victor:lib:1.0.1'
compile 'com.shamanland:fonticon:0.1.8'
compile 'jp.wasabeef:recyclerview-animators:2.2.7'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.github.vihtarb:tooltip:0.1.9'
compile 'com.daasuu:CountAnimationTextView:0.1.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
compile('com.android.billingclient:billing:1.0') {
exclude module: 'support-compat'
exclude group: 'com.google.android', module: 'support-v4'
}
compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
// exclusion is not necessary, but generally a good idea.
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.nbsp:library:1.8'
apt 'com.jakewharton:butterknife-compiler:8.8.1'
apt 'org.parceler:parceler:1.1.5'
compile 'com.google.guava:guava:19.0'
compile 'org.bouncycastle:bcprov-jdk16:1.46'
}
apply plugin: 'com.google.gms.google-services'
非常感谢任何建议或解决方案。谢谢。
检查您是否在离线工作。
文件 > 设置 > 在搜索栏上输入 "offline" > Gradle > 取消选中 "offline work".
使用关键字 "implementation" 而不是 "compile"。 Compile 已被弃用,并将在 2018 年底被放弃。这是一个远景,但自上次 Android Studio 更新以来可能已经发生了一些变化。
明确添加 com.android.support:support-core-ui:27.1.1 到您的依赖项。
如果有帮助请告诉我。
祝你好运。
更新:
如果你去
https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/support/support-core-ui/27.1.1/
您会发现您的 *.jar 文件不存在。
不过还有其他几个:
- 支持核心-ui-27.1.1-sources.jar
- 支持核心-ui-27.1.1.aar
- 支持核心-ui-27.1.1.pom
您可以改用 *.aar 文件。
我确实遇到了这个问题,意识到我也在上次成功构建和现在损坏的构建之间将 gradle 更新为 4.8。我降级回 4.7,我的持续集成构建再次工作。
所以我已经能够解决问题,但也许只是一种解决方法,所以至少我的 CI 构建通过了。似乎在我的 gradle 依赖项中包含这一行修复了它:
implementation "com.android.support:support-core-utils:27.1.1"
我还确保 google() 是我的顶级 gradle 存储库中列出的第一个
我刚刚在自己的构建服务器上解决了这个问题。我更新了 build.gradle 中的存储库块,将 google()
作为第一个条目,如下所示:
allprojects {
repositories {
google()
jcenter()
}
}
编辑:删除了不需要的存储库。
切换自
jcenter()
google()
到
google()
jcenter()
我在 build.gradle
中添加了 google()
buildscript {
repositories {
jcenter()
google()
mavenLocal()
maven { url 'https://maven.google.com' }
}
}
allprojects {
repositories {
jcenter()
google()
mavenLocal()
maven { url 'https://maven.google.com' }
}
}
对我来说,它解决了问题。
你也可以试试
好的,这就是原因:
AAPT2 现在在 Google 的 Maven 存储库中:要使用 AAPT2,您必须将 Google 的 Maven 存储库添加到您的项目级别 build.gradle
,如下图。 Learn more
buildscript.repositories {
google()
jcenter()
...
}
allprojects.repositories {
google()
jcenter()
...
}
我已经在这个Android项目上工作了大约一年,昨天我打开它时突然AndroidStudio 3.1.2无法同步gradle和项目不再构建给我这个错误:
Could not find support-core-ui.jar (com.android.support:support-core-ui:27.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-core-ui/27.1.1/support-core-ui-27.1.1.jar
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager
我很确定 Android 支持存储库安装正确,因为它在其他项目中运行成功,我的所有其他项目都运行良好,没有任何问题。
我在应用程序模块中有这个 gradle 文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
}
}
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'realm-android'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 32
versionName "3.1"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id : "",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
if (requested.group == 'com.google.android.gms') {
details.useVersion '15.0.1'
}
if (requested.group == 'com.google.firebase') {
details.useVersion '15.0.1'
}
}
}
buildTypes {
release {
minifyEnabled false
// proguardFiles 'proguard.cfg'
}
}
useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
}
}
repositories {
maven {
url "https://jitpack.io"
}
maven {
url "https://dl.bintray.com/lukaville/maven"
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
mavenCentral()
}
dependencies {
compile project(':FORTSDKv1.4.1')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/gcm.jar')
compile files('libs/httpclient-4.3.4.jar')
compile files('libs/httpmime-4.2.5.jar')
compile files('libs/HockeySDK-3.0.2.jar')
compile files('libs/samsungpay-1.8.00.jar')
compile project(':library-2.4.1')
// Required for geotagging
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
compile('com.code-troopers.betterpickers:library:3.1.0') {
exclude group: 'com.nineoldandroids', module: 'library'
}
compile 'com.android.support:support-v4:27.0.0'
// https://mvnrepository.com/artifact/com.android.support/support-core-ui
compile group: 'com.android.support', name: 'support-core-ui', version: '27.1.1'
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'com.android.support:customtabs:27.0.0'
compile 'com.android.support:multidex:1.0.3'
compile 'com.googlecode.libphonenumber:libphonenumber:8.8.9'
compile 'org.parceler:parceler-api:1.1.5'
compile('com.google.android.gms:play-services-analytics:11.8.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
// compile 'com.google.android.gms:play-services-analytics:11.8.0'
compile 'com.github.hackware1993:MagicIndicator:1.5.0'
compile 'com.roomorama:caldroid:2.3.1'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.leocardz:aelv:1.1@aar'
compile 'com.flaviofaria:kenburnsview:1.0.7'
compile('com.jakewharton:butterknife:8.4.0') {
exclude module: 'support-compat'
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.jrvansuita:IconHandler:+'
compile 'com.github.mancj:SlideUp-Android:2.2.5'
compile 'com.afollestad:sectioned-recyclerview:0.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile 'com.uphyca:stetho_realm:2.0.0'
compile 'org.greenrobot:eventbus:3.1.1'
compile 'com.birbit:android-priority-jobqueue:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
compile 'com.valdesekamdem.library:md-toast:0.8.0'
compile 'com.facebook.android:account-kit-sdk:4.30.0'
compile 'com.facebook.android:facebook-android-sdk:4.17.0'
compile 'com.wang.avi:library:2.1.3@aar'
compile 'com.afollestad.material-dialogs:core:0.9.6.0'
// compile 'com.onesignal:OneSignal:3.6.5'
compile 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
compile 'com.kbeanie:image-chooser-library:1.6.0@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.scalified:fab:1.1.3'
compile 'com.github.traex.expandablelayout:library:1.2.2'
compile 'com.github.markomilos:paginate:0.5.1'
compile 'com.wdullaer:materialdatetimepicker:3.3.0'
compile 'com.github.tamir7.contacts:contacts:1.1.7'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.github.livechat:chat-window-android:v2.0.0'
compile 'com.uber.sdk:rides-android:0.6.1'
compile 'link.fls:swipestack:0.3.0'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.victor:lib:1.0.1'
compile 'com.shamanland:fonticon:0.1.8'
compile 'jp.wasabeef:recyclerview-animators:2.2.7'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.github.vihtarb:tooltip:0.1.9'
compile 'com.daasuu:CountAnimationTextView:0.1.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
compile('com.android.billingclient:billing:1.0') {
exclude module: 'support-compat'
exclude group: 'com.google.android', module: 'support-v4'
}
compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
// exclusion is not necessary, but generally a good idea.
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.nbsp:library:1.8'
apt 'com.jakewharton:butterknife-compiler:8.8.1'
apt 'org.parceler:parceler:1.1.5'
compile 'com.google.guava:guava:19.0'
compile 'org.bouncycastle:bcprov-jdk16:1.46'
}
apply plugin: 'com.google.gms.google-services'
非常感谢任何建议或解决方案。谢谢。
检查您是否在离线工作。
文件 > 设置 > 在搜索栏上输入 "offline" > Gradle > 取消选中 "offline work".
使用关键字 "implementation" 而不是 "compile"。 Compile 已被弃用,并将在 2018 年底被放弃。这是一个远景,但自上次 Android Studio 更新以来可能已经发生了一些变化。
明确添加 com.android.support:support-core-ui:27.1.1 到您的依赖项。
如果有帮助请告诉我。
祝你好运。
更新:
如果你去
https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/support/support-core-ui/27.1.1/
您会发现您的 *.jar 文件不存在。
不过还有其他几个:
- 支持核心-ui-27.1.1-sources.jar
- 支持核心-ui-27.1.1.aar
- 支持核心-ui-27.1.1.pom
您可以改用 *.aar 文件。
我确实遇到了这个问题,意识到我也在上次成功构建和现在损坏的构建之间将 gradle 更新为 4.8。我降级回 4.7,我的持续集成构建再次工作。
所以我已经能够解决问题,但也许只是一种解决方法,所以至少我的 CI 构建通过了。似乎在我的 gradle 依赖项中包含这一行修复了它:
implementation "com.android.support:support-core-utils:27.1.1"
我还确保 google() 是我的顶级 gradle 存储库中列出的第一个
我刚刚在自己的构建服务器上解决了这个问题。我更新了 build.gradle 中的存储库块,将 google()
作为第一个条目,如下所示:
allprojects {
repositories {
google()
jcenter()
}
}
编辑:删除了不需要的存储库。
切换自
jcenter()
google()
到
google()
jcenter()
我在 build.gradle
中添加了 google()buildscript {
repositories {
jcenter()
google()
mavenLocal()
maven { url 'https://maven.google.com' }
}
}
allprojects {
repositories {
jcenter()
google()
mavenLocal()
maven { url 'https://maven.google.com' }
}
}
对我来说,它解决了问题。 你也可以试试
好的,这就是原因:
AAPT2 现在在 Google 的 Maven 存储库中:要使用 AAPT2,您必须将 Google 的 Maven 存储库添加到您的项目级别 build.gradle
,如下图。 Learn more
buildscript.repositories {
google()
jcenter()
...
}
allprojects.repositories {
google()
jcenter()
...
}