2

I'm trying out Android Studio 3.0 Canary 9 with an existing project, and I'm getting this error trying to sync the build files:

Error:Failed to resolve: commons-logging:commons-logging:1.1.1

I am not adding commons-logging as a dependency, so it must be used by some other dependency but I don't know what. Here's the buildscript section of my top-level build file where I made changes for 3.0:

buildscript {
    repositories {
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha9'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.5'
    }
}

In gradle-wrapper.properties I have this:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip

The only change I made in the project build file was to the way I was renaming the APK file. Anybody know how to track down this dependency and what to do to fix it?

stkent
  • 19,772
  • 14
  • 85
  • 111
nasch
  • 5,330
  • 6
  • 31
  • 52
  • 1
    I wonder if it's related to https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_separation, but that's a shot in the dark :S – stkent Aug 08 '17 at 03:22
  • @stkent I think that was an appropriate change to make but it didn't fix the problem. – nasch Aug 08 '17 at 14:40

4 Answers4

3

If you using Android Gradle 2.2 plugin or newer, then you should remove com.neenbedankt.gradle.plugins:android-apt from your Gradle plugins. Also change all apt in dependencies to annotationProcessor

You can read more here

DeKaNszn
  • 2,720
  • 3
  • 26
  • 26
  • No dice, same problem after making that change and also changing `compile` to `implementation`. – nasch Aug 08 '17 at 14:41
1

I don't know if this will fix, but it might help in locating the issue.

start a new empty project using AS 3.0, add the 3 dependencies 1 by 1 while testing in between each add. I have a suspicion one of them doesn't play nicely with AS 3.0, and that it has nothing to do with your code since you made no changes.

Another thing you can try is going back to an older version of AS and rechecking that it runs. This isolates the issue to AS 3.0 and not your code or dependencies.

Lastly if nothing works, create a brand new project with new package name and manually copy paste everything into the new project. I usually find lots of bugs doing this.

Bqin1
  • 467
  • 1
  • 9
  • 19
  • 1
    It works fine with AS 2.3. I thought of a new project but 1. I have a lot more than 3 dependencies in my project file and 2. What would I do once I found the problem one? – nasch Aug 08 '17 at 03:55
  • 1
    Thanks for the update! Once you find the individual problem, it makes searching for answer much faster because you can pinpoint search with a specific name. – Bqin1 Aug 08 '17 at 11:58
1

I followed moonpire00's suggestion and created a new project. I discovered that the problem was with the AWS imports:

implementation 'com.amazonaws:aws-android-sdk-core:2.2.0'
implementation 'com.amazonaws:aws-android-sdk-ses:2.2.0'

I changed them to this:

implementation 'com.amazonaws:aws-android-sdk-core:2.2.0', {
        exclude module: 'commons-logging'
    }
    implementation 'com.amazonaws:aws-android-sdk-ses:2.2.0', {
        exclude module: 'commons-logging'
    }

And now the gradle sync works! If anyone has insight into why this error would appear with Android Studio / gradle 3.0, please post a comment.

nasch
  • 5,330
  • 6
  • 31
  • 52
  • Great! Glad it helped you. I am no dependency expert but the new project thing usually solves my dependency issues haha – Bqin1 Aug 08 '17 at 15:13
0

Its Working

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.keshav.mraverification"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7:26.0.1'
    compile 'com.android.support:design:26.0.1'


    testCompile 'junit:junit:4.12'
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
Keshav Gera
  • 10,807
  • 1
  • 75
  • 53