Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
edited tags; edited title
Link
hqt
  • 30.4k
  • 54
  • 180
  • 256

Android Studio : Config Gradle file for Multiplie Projects and Librarieslibrary project

Source Link
hqt
  • 30.4k
  • 54
  • 180
  • 256

Android Studio : Config Gradle for Multiplie Projects and Libraries

I have an Android Project, and I want to create a sub-library (just another Android Project) as library for this one.

Here is my Structure:

Project/ settings.gradle build.gradle /ProjectA /ProjectA/build.gradle /ProjectA/libs /ProjectA/libs/ProjectB /ProjectA/libs/ProjectB/build.gradle 

ProjectA is my main project. I do as following. In setting.gradle. I add:

include ':ProjectA' include ':ProjectA:libs:ProjectB' 

after that. I copy all information of ProjectA/build.gradle into ProjectB/build.gradle content of file is:

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.1.1" defaultConfig { minSdkVersion 9 targetSdkVersion 18 } buildTypes { debug { packageNameSuffix ".debug" } } } 

After that, I change ProjectA/build.gradle. Add this line: compile projects(:libs:projectB) to dependencies. After that I receive error :

Project with path ':libs:ProjectB' could not be found in project ':ProjectA' 

Please help me how to configure for multiply project in Android Studio.

Thanks :)