Gradle Build Error找不到supportlibrary

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle Build Error找不到supportlibrary相关的知识,希望对你有一定的参考价值。

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

我试过干净的项目,在android工作室中使缓存无效,重新启动我的Android工作室它没有帮助。

如果我将我的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'
答案

您是否在自己的应用中使用OneSignal SDK?

如果是,您应该使用此包含:

compile 'com.onesignal:OneSignal:3.5.8'

你应该将buildToolsVersion,targetSdkVersion和compileSdkVersion降级到26.0.2而不是27。

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

来源:

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

以上是关于Gradle Build Error找不到supportlibrary的主要内容,如果未能解决你的问题,请参考以下文章

Gradle build:找不到文件错误

错误:(26, 0) 找不到 Gradle DSL 方法:'runProguard()'

错误:找不到 com.google.gms:google-services:1.0。在 android studio 的 build.gradle 中添加谷歌服务插件时

Gradle 错误:找不到 com.android.tools.build:gradle:6.6.1

找不到 com.android.tools.build:gradle:4.4

找不到com.android.tools.build:gradle:2.3.3