0

I trying to Import my project in android studio 3.3.2 (latest version) but The IDE tell couldn't find (or download ) this plugin! I checked internet connection, firewall and other involving But can't figure it out why android studio cant download or find this plugin.

Note: I can download files by pasting link in 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 :

So this is my gradle config ( app-level ) :

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')
}

My project Gradle config is this ( NOT 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()
        }
    }
}
Ken White
  • 123,280
  • 14
  • 225
  • 444
TheXrion
  • 17
  • 7
  • Are you behind a proxy or firewall ? Have you added the google() repo in your build gradle file. Check out this SO question -https://stackoverflow.com/questions/46953881/gradle-could-not-find-dependency-com-google-android-gmsplay-services/47151505 – Dibzmania Apr 04 '19 at 00:28
  • @Dibzmania Yes i'm behind a proxy and can't go on without proxies . – TheXrion Apr 04 '19 at 14:31
  • @Negarehgfx Then you need to talk to the network administrator, to make exception for the google links. It is mostly the proxies that is blocking the access. I had similar issue in my previous workplace. – Dibzmania Apr 05 '19 at 05:20

2 Answers2

2

In your root-level build.gradle make sure you are using the Google Maven repository and add the oss-licenses plugin to your dependencies:

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'
  }

In your app-level build.gradle, apply the plugin by adding the following line under the existing apply plugin: 'com.android.application' at the top of the file:

apply plugin: 'com.google.android.gms.oss-licenses-plugin'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Ranjan Kumar
  • 1,164
  • 7
  • 12
  • That plugins and other staff you mentioned was added by default and there is nothing more to do by me ! So this is the problem that confused me ! – TheXrion Apr 04 '19 at 14:19
0

In my case i was behind A proxy . Problem Solved by using FOD proxy Services Click for more info! in Android Studio And Everything worked fine .

TheXrion
  • 17
  • 7