【问题标题】:Gradle Build Error could not find supportlibraryGradle 构建错误找不到支持库
【发布时间】:2018-05-29 14:05:17
【问题描述】:

我正在使用支持库版本 27.0.0 我得到这个奇怪的构建错误。我使用的支持库是 27.0.0 但它仍然会为 27.0.99 抛出错误

我尝试过干净的项目,使 Android Studio 中的缓存无效,重新启动我的 android Studio 没有帮助。

如果我将 buildtoolversion 和支持库更新到 27.0.2,它仍然会为 27.0.99 抛出错误

Error:Could not find com.android.support:customtabs:27.0.99.
Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/support/customtabs/27.0.99/customtabs-27.0.99.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/support/customtabs/27.0.99/customtabs-27.0.99.jar
    https://jcenter.bintray.com/com/android/support/customtabs/27.0.99/customtabs-27.0.99.pom
    https://jcenter.bintray.com/com/android/support/customtabs/27.0.99/customtabs-27.0.99.jar
    https://repo1.maven.org/maven2/com/android/support/customtabs/27.0.99/customtabs-27.0.99.pom
    https://repo1.maven.org/maven2/com/android/support/customtabs/27.0.99/customtabs-27.0.99.jar
    https://maven.fabric.io/public/com/android/support/customtabs/27.0.99/customtabs-27.0.99.pom
    https://maven.fabric.io/public/com/android/support/customtabs/27.0.99/customtabs-27.0.99.jar
    https://jitpack.io/com/android/support/customtabs/27.0.99/customtabs-27.0.99.pom
    https://jitpack.io/com/android/support/customtabs/27.0.99/customtabs-27.0.99.jar
    https://maven.google.com/com/android/support/customtabs/27.0.99/customtabs-27.0.99.pom
    https://maven.google.com/com/android/support/customtabs/27.0.99/customtabs-27.0.99.jar
Required by:
    project :app

Please install the Android Support Repository from the Android SDK Manager.
<a href="openAndroidSdkManager">Open Android SDK Manager</a>

我为谷歌的支持库添加了 maven

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

这是我的默认 gradle 配置

compileSdkVersion 27
buildToolsVersion "27.0.0"
defaultConfig {
        vectorDrawables.useSupportLibrary = true
        applicationId "com.pro.test"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 18
        versionName "1.17"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config
        multiDexEnabled true
 }

我使用的支持库是

compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:27.0.0'
compile 'com.android.support:support-v4:27.0.0'    
compile 'com.android.support:customtabs:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'

【问题讨论】:

  • 你加了maven { url 'https://maven.google.com' }..???
  • @Nilu 是的,我的 gradle 文件中已经有了它
  • @iCoder 检查 selvin 评论
  • @Selvin 对不起,我不明白。我有什么需要改变的吗?
  • 在你的情况下,我将通过./gradlew app:dependencies 看看它来自哪里,找到包含这个库版本的那个。

标签: android gradle android-gradle-plugin android-support-library onesignal


【解决方案1】:

您是否在应用中使用 OneSignal SDK ?

如果是,你应该使用这个包含来代替:

compile 'com.onesignal:OneSignal:3.5.8'

您应该将 buildToolsVersiontargetSdkVersioncompileSdkVersion 降级到 26.0.2 而不是 27。

它似乎不是 100% 兼容 v27 :)

来源:

https://github.com/OneSignal/OneSignal-Android-SDK/issues/352 https://github.com/OneSignal/OneSignal-Android-SDK/issues/303

【讨论】:

    猜你喜欢
    • 2018-11-06
    • 2013-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-08
    • 2017-10-06
    相关资源
    最近更新 更多