0

I am working on a Parent android project that has two buttons. I also have two android Child projects. Each button click on the Parent project is supposed to open one of these Child projects. I searched online and found that I can combine all three projects by making the Child projects as libraries and include them in the Parent (as libraries). I've converted the two child projects in libraries using this link. After converting, I am following this video to add the child libraries to the parent android project. However, Gradle Sync fails with the following error:

Error: Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :libraries:ChildProject2

This error is caused by the following line in build.gradle (of parent project):

compile project(':libraries:ChildProject2')

I am new to android and don't know how to solve this issue. I have tried the link below, however, I can't solve the problem. Any help will be appreciated.

link: https://discuss.gradle.org/t/dependencies-failing-to-resolve-due-to-configuration-dependencies/1617

settings.gradle

include ':app'
include ':libraries:ChildProject2'

Build.gradle:

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.example.smartfarmer.parentproject"
    minSdkVersion 21
    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(include: ['*.jar'], dir: 'libs')
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.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':libraries:ChildProject2')//, configuration: "compile")
}
Umar Dastgir
  • 688
  • 9
  • 25

0 Answers0