18

After an update I made on 27-03-2018, my gradle sync is failing.I am getting the error

Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2.

I am posting my gradle files below. I have tried cleaning and rebuilding the project, but it is still not working.

Project level gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.loopj.android:android-async-http:1.4.9'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App level gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        google()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    lintOptions {
        disable 'InvalidPackage'
    }
    defaultConfig {
        applicationId 'app.myapp.com'
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 33
        versionName "1.1.30"
        useLibrary 'org.apache.http.legacy'
        // Enabling multidex support.
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    dexOptions {
        preDexLibraries = false
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    lintOptions {
        checkReleaseBuilds false
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}
repositories {
    mavenCentral()
    jcenter()

    maven { url 'https://maven.fabric.io/public'

    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])


    compile project(':android-async-http-1.4.9')


    //    compile 'com.daimajia.androidanimations:library:1.0.3@aar'
    compile project(':PayTabs_SDK_NOSCAN')
    compile('com.twitter.sdk.android:twitter:1.14.1@aar') {
        transitive = true;
    }
    compile('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    compile files('libs/signpost-core-1.2.1.2.jar')
    // Discovery and Outlook services
    compile('com.microsoft.services:discovery-services:1.0.0@aar') {
        transitive = true
    }
    compile('com.microsoft.services:outlook-services:1.0.0@aar') {
        transitive = true
    }
    compile 'org.sufficientlysecure:html-textview:3.3'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'cz.msebera.android:httpclient:4.3.6'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'me.dm7.barcodescanner:zxing:1.8.4'
    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.gms:google-services:3.0.0'
    compile 'com.google.android.gms:play-services-ads:9.0.0'
    compile 'com.google.android.gms:play-services-auth:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile 'org.codepond:wizardroid:1.3.1'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.google.zxing:core:3.2.0'
    compile 'io.card:android-sdk:5.3.0'
    compile 'com.google.firebase:firebase-messaging:9.0.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'me.dm7.barcodescanner:zbar:1.8.2'
    compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.cloudrail:cloudrail-si-android:2.11.0'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.ss.bannerslider:bannerslider:1.8.0'
    compile 'com.marshalchen.ultimaterecyclerview:library:0.7.3'
//    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"


    testCompile 'junit:junit:4.12'
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.1'
            }
        }
    }
}

I tried all that I know, but nothing is working for now. Android Studio and Gradle are updated to the latest version. The app used to work before the update. I followed the instructions in developer.android.com about gradle migration, but nothing is mentioned there that might help me with the issue.

I am posting the error I get here

Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2.
Searched in the following locations:
    https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom
    https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar
    https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom
    https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar
Required by:
    project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1
    project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.build:builder:3.0.1
    project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1
    project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.build:builder:3.0.1 > com.android.tools:sdk-common:26.0.1
    project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.build:builder:3.0.1 > com.android.tools:sdklib:26.0.1 > com.android.tools:repository:26.0.1
    project :app > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1 > com.android.tools.lint:lint-checks:26.0.1 > com.android.tools.lint:lint-api:26.0.1
mad_greasemonkey
  • 864
  • 2
  • 15
  • 32
  • Clean the project, rebuild. [Source: https://github.com/rovo89/XposedInstaller/issues/400 ] – Dr.jacky Mar 27 '18 at 07:11
  • Tried that already before posting this. – mad_greasemonkey Mar 27 '18 at 07:18
  • Tried running a project with your configuration and hit the same wall. Looking at the full error trace, it seems like there are multiple dependencies that cannot be found. Maybe try updating those? full log that I got is here https://paste.ee/p/8MxZX – RWIL Mar 27 '18 at 09:26
  • you can try disabling gradle offline mode and then try syncing again – Paras Watts Mar 27 '18 at 09:46
  • Try to add more repositories in your App level gradle. See https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib/1.1.3-2. It doesn't have google or maven, and it's probably the reason why you're having the error messages. – konsolebox Mar 29 '18 at 16:29

7 Answers7

5

i too came up with the same issue. seems like android studio seeking to update the kotlin plugin as well.

go to Tools > Kotlin > Configure Kotlin Plugin Update and update the plugin. then restart studio, and it will sync the gradle on restart.

Pixxu Waku
  • 423
  • 8
  • 21
3

I found the answer. I changed the versions of gradle plugins.I am adding my Gradle files below

Project Level

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.1.1'
        classpath 'com.loopj.android:android-async-http:1.4.9'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App Level build.gradle file

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    lintOptions {
        disable 'InvalidPackage'
    }
    defaultConfig {
        applicationId 'app.ecopon.com'
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 33
        versionName "1.1.30"
        useLibrary 'org.apache.http.legacy'
        // Enabling multidex support.
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    dexOptions {
        preDexLibraries = false
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
    lintOptions {
        checkReleaseBuilds false
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
}
repositories {
    mavenCentral()
    jcenter()

    maven { url 'https://maven.fabric.io/public'

    }

    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])


    compile project(':android-async-http-1.4.9')

    //    compile 'com.daimajia.androidanimations:library:1.0.3@aar'
    compile project(':PayTabs_SDK_NOSCAN')
    compile('com.twitter.sdk.android:twitter:1.14.1@aar') {
        transitive = true;
    }
    compile('org.apache.httpcomponents:httpmime:4.3') {
        exclude module: "httpclient"
    }
    compile files('libs/signpost-core-1.2.1.2.jar')
    // Discovery and Outlook services
    compile('com.microsoft.services:discovery-services:1.0.0@aar') {
        transitive = true
    }
    compile('com.microsoft.services:outlook-services:1.0.0@aar') {
        transitive = true
    }

    compile 'org.sufficientlysecure:html-textview:3.3'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'cz.msebera.android:httpclient:4.3.6'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'me.dm7.barcodescanner:zxing:1.8.4'
    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.gms:google-services:3.0.0'
    compile 'com.google.android.gms:play-services-ads:9.0.0'
    compile 'com.google.android.gms:play-services-auth:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile 'org.codepond:wizardroid:1.3.1'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.google.zxing:core:3.2.0'
    compile 'io.card:android-sdk:5.3.0'
    compile 'com.google.firebase:firebase-messaging:9.0.0'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'me.dm7.barcodescanner:zbar:1.8.2'
    compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.cloudrail:cloudrail-si-android:2.11.0'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.ss.bannerslider:bannerslider:1.8.0'
    compile 'com.marshalchen.ultimaterecyclerview:library:0.7.3'

    compile 'com.github.barteksc:android-pdf-viewer:2.8.2'


    testCompile 'junit:junit:4.12'
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.1'
            }
        }
    }
}

Now, everything is working perfectly

mad_greasemonkey
  • 864
  • 2
  • 15
  • 32
2

Found a solution to this. You need to add google() to the buildscript and allprojects repository section as below:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
1

1- Go to http://services.gradle.org

2- Go to Distributions

3- Click on the latest one to download it (I downloaded "gradle-4.6-rc-2-all.zip")

4- Unzip or Extract it

5- In Android Studio go to File > Settings > Build, Execution, Deployment > Gradle > Use local gradle distribution > then choose the file (that you just download and unzip it) from your computer

6- Click Ok

7- Inside "build.gradle(Module:app)" make sure that compileSdkVersion and targetSdkVersion are same

8- Click Sync Now

Resource: https://www.youtube.com/watch?v=q_qWUQNbFLY

Alkhalil
  • 61
  • 8
1

Change your Buildscript part of your build.gradle To this , Actully Remove google() & jcenter(). This Worked for me.

buildscript {

repositories {
    maven { url 'https://jitpack.io' }
    mavenCentral()
    maven { url "https://maven.google.com" }
}


dependencies {
    classpath 'com.android.tools.build:gradle:3.1.0'
}
}
0

You could try updating your Kotlin version and maybe add https://maven.google.com to the repositories tag of allProjects.

Your project level build.gradle should look something like this afterwards:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
   ext.kotlin_version = '1.2.30'
   repositories {
      jcenter()
      google()
   }
   dependencies {
      classpath 'com.android.tools.build:gradle:3.1.0'
      classpath 'com.google.gms:google-services:3.1.0'
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
      classpath 'com.loopj.android:android-async-http:1.4.9'
   }
}

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

task clean(type: Delete) {
   delete rootProject.buildDir
}

Besides that, try cleaning the project and maybe removing your .gradle folders manually

RWIL
  • 8,729
  • 1
  • 28
  • 37
  • That didnt work for me. Which all .gradle folders should I remove ? – mad_greasemonkey Mar 27 '18 at 08:48
  • In your projects directory there is a `.gradle` folder, if that doesn't work you can try removing the .gradle folder in your user home directory (at least on windows) – RWIL Mar 27 '18 at 09:06
0

Try to invalidate cache(did it a few times) or reinstall studio, or check gradle-wrapper.properties distributionUrl should be like this:

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

Skullper
  • 714
  • 5
  • 22