Upgraded to Android Studio 3.0: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :appLib
Asked Answered
R

1

8

After upgrading to Android Studio 3.0 gradle snyc fails with the following error messages:

Unable to resolve dependency for ':Skynavigator@debug/compileClasspath': Could not resolve project :SkyNavLib.

Unable to resolve dependency for ':Skynavigator@debugAndroidTest/compileClasspath': Could not resolve project :SkyNavLib.

Unable to resolve dependency for ':Skynavigator@debugUnitTest/compileClasspath': Could not resolve project :SkyNavLib.

Unable to resolve dependency for ':Skynavigator@release/compileClasspath': Could not resolve project :SkyNavLib.

Unable to resolve dependency for ':Skynavigator@releaseUnitTest/compileClasspath': Could not resolve project :SkyNavLib.

I already checked all solutions from the following link, but none worked. I also created a new project which also contains a library, and this project syncs without any problem.

Below the used build.gradle files:

For the project:

buildscript {

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

}
}

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

for the App:

apply plugin: 'com.android.application'


android {
updateVersionProperties()

compileSdkVersion 26

defaultConfig {
    minSdkVersion 17
    targetSdkVersion 24
    versionCode getAndroidVersionCode()
    versionName getAndroidVersionName()
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}


buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}



lintOptions
        {
            abortOnError false
        }
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'net.sf.marineapi:marineapi:0.10.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation files('libs/usbserial.jar')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation project(':SkyNavLib')
}

for the Library:

apply plugin: 'com.android.application'

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

}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('src/main/java/app/skynavigator/common/skynavlib/xml/gson-2.5.jar')
}

android {
compileSdkVersion 26

defaultConfig {
    minSdkVersion 17
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {

    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}


}
Retinoscope answered 9/4, 2018 at 10:22 Comment(4)
please go through this developer.android.com/studio/build/…Aleen
This have the similar issues pls see this #47264168Aleen
does the settings.gradle file contains reference to SkyNavLib?Milburt
Thanks for the tips. I already the 2 mentioned links and tried out everything proposed there, but still the same issue. The settings.gradle file also contains the SkyNavLib reference.Retinoscope
S
12

Your library is using the wrong plugin, it should be apply plugin: 'com.android.library' instead of apply plugin: 'com.android.application'.

Moreover you should not put the allProjects node into this build.gradle file.

new library build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 26

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.gms:play-services-maps:12.0.1'
    implementation 'com.google.android.gms:play-services:12.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation files('src/main/java/app/skynavigator/common/skynavlib/xml/gson-2.5.jar')
}
Suppress answered 11/4, 2018 at 5:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.