找不到com.google.android.gms:oss-licenses-plugin:0.9.3

时间:2019-04-04 00:04:48

标签: android gradle android-gradle

我试图在android studio 3.3.2(最新版本)中导入项目,但IDE告诉找不到(或下载)此插件!我检查了互联网连接,防火墙和其他相关问题,但无法弄清为什么android studio无法下载或找到此插件。

注意:我可以通过将链接粘贴到chrome中来下载文件。

CONFIGURE FAILED in 8s ERROR: Could not find com.google.android.gms:oss-licenses-plugin:0.9.4. Searched in the following locations: https://maven.google.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.pom https://maven.google.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.jar https://jcenter.bintray.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.pom https://jcenter.bintray.com/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.jar https://dl.google.com/dl/android/maven2/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.pom https://dl.google.com/dl/android/maven2/com/google/android/gms/oss-licenses-plugin/0.9.4/oss-licenses-plugin-0.9.4.jar Required by: project :

这是我的gradle配置(应用程序级别)

apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.sherdle.universal"
        minSdkVersion 16
        targetSdkVersion 27
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }

        //Optionally configure your OneSignal IDs below
        manifestPlaceholders = [manifestApplicationId          : "${applicationId}",
                                onesignal_app_id               : "",
                                onesignal_google_project_number: ""]
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    dexOptions {
        jumboMode true
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
    maven {
        url "https://jitpack.io"
    }
    jcenter()
    google();
}

dependencies {
    implementation 'com.devbrackets.android:exomedia:4.0.3' //TV
    implementation 'com.google.android.exoplayer:exoplayer:r2.4.3' //TV & Radio
    implementation 'com.cleveroad:audiovisualization:1.0.0' //Radio
    implementation 'com.google.code.gson:gson:2.8.0' //WC
    implementation 'com.squareup.okhttp3:okhttp:3.7.0' //WC
    implementation 'org.jsoup:jsoup:1.8.3'
    implementation 'com.onesignal:OneSignal:[3.9.3,4.0.0)'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.duolingo.open:rtl-viewpager:1.0.2'
    implementation 'com.github.chrisbanes:PhotoView:1.3.0'
    implementation 'com.android.support:multidex:1.0.3'

    implementation "com.android.support:cardview-v7:$supportlib_version"
    implementation "com.android.support:appcompat-v7:$supportlib_version"
    implementation "com.android.support:recyclerview-v7:$supportlib_version"
    implementation "com.android.support:design:$supportlib_version"
    implementation "com.android.support:support-v4:$supportlib_version"
    implementation "com.android.support:support-core-utils:$supportlib_version"
    implementation "com.android.support:support-media-compat:$supportlib_version"

    implementation "com.google.android.gms:play-services-oss-licenses:$gps_version"
    implementation "com.google.android.gms:play-services-gcm:$gps_version"
    implementation "com.google.android.gms:play-services-ads:$gps_version"
    implementation "com.google.android.gms:play-services-maps:$gps_version"
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
}

我的项目Gradle配置是(不是APP-LEVEL)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        maven {
            url 'https://jitpack.io'
        }
    }
}

buildscript {
    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'com.google.android.gms:oss-licenses-plugin:0.9.4'

    }
    repositories {
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
        google()
    }
}

ext {
    supportlib_version = '27.1.1'
    gps_version = '15.0.0'
}

//Ensure that all dependencies use the same version of the Android Support library
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "$supportlib_version"
            }
            if (details.requested.group == 'com.google.android.gms'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "$gps_version"
            }
            if (details.requested.group == 'com.google.firebase'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "$gps_version"
            }
        }
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
            google()
        }
    }
}

2 个答案:

答案 0 :(得分:1)

在您的根级别build.gradle中,确保您使用的是Google Maven存储库,并将oss-licenses插件添加到您的依赖项中:

buildscript {
  repositories {
    // ...
    google()  // maven { url "https://maven.google.com" } for Gradle <= 3
  }
  dependencies {
    // ...
    // Add this line:
    classpath 'com.google.android.gms:oss-licenses-plugin:0.9.4'
  }

在您的应用级build.gradle中,通过在文件顶部现有apply plugin: 'com.android.application'下添加以下行来应用插件:

apply plugin: 'com.google.android.gms.oss-licenses-plugin'

答案 1 :(得分:0)

就我而言,我落后于A代理人。通过在Android Studio中使用FOD代理服务Click for more info!解决了问题,并且一切正常。