5er
5er

Reputation: 2705

cannot resolve dependencies in Android Studio

Im really stuck whit this:

apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '20.0.0'

defaultConfig {
    applicationId "com.example.testing"
    minSdkVersion 14
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
   compile project(':External-Module')
}

I dont know what to do... I cant build project and use dependencies from External module.

the error is:

Error:(7, 47) error: package com.example.android.transfer does not exist
Error:(19, 9) error: cannot find symbol class ClientData
Error:(19, 25) error: cannot find symbol variable ClientData
Error:Execution failed for task ':Testing:compileDebugJava'.

but inside the IDE all is well and I can see the module

enter image description here

Here is also the External Module

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '20.0.0'

defaultConfig {
    applicationId "com.example.externalmodule"
    minSdkVersion 14
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
}

Upvotes: 0

Views: 1262

Answers (1)

Robert Estivill
Robert Estivill

Reputation: 12497

Your "External-Module" is an Android library, so according to the Gradle+Android documentation instead of

apply plugin: 'com.android.application'

it should be

apply plugin: 'com.android.library'

// Old version of the plugin
// apply plugin: 'android-library' 

Also, make sure the imports in your app matches the package you are overriding in your library build script. Looks like the app is not founding com.example.android.transfer but the library package really is com.example.externalmodule

Upvotes: 2

Related Questions