简体   繁体   中英

Android Studio Gradle external directory / library with Git

I have looked at all the other SO suggestions and nothing is working. I just get different error messages.

Android Studio 1.3
Git directory structure layout
company-app (Git repo)
  app
company-app2 (Git repo)
  app2
company-library (Git repo)
  library

I have two Android apps that both want to use an Android library. All code written by me so I am not talking about simply pointing to a Maven or Gradle pre-built library. All code in Git as shown in three different repositories so we can update the code independently.

How Android Studio wants it (ie the only way to get it to work)

company-android (Git repository)
  company-app
  company-app2
  company-library

This is not going to work as there is only one repository not the three I want. You can't easily branch app2 while working on app etc.

I have tried doing this:

project(':LibraryModule').projectDir = new File('../mySDK_Folder/LibraryModule')

But I just get this error

Error:Configuration with name 'default' not found.

Yes, the library code / directory has all the possible Gradle files. Everything works like a champ if I do the second directory structure layout where the app and the library directories are peers under a root, just not the one I want where they are not in the same root.

I really don't want to do OS based symbolic directory linking as that is a hack.

Why can't Android Studio / Gradle / IntelliJ handle this very common layout requirement? It seems like older version of Android Studio could but newer versions can not but even with older versions how you did it changed over time.

Make sure ('../mySDK_Folder/LibraryModule') is actually the right location.

Something tells me you're looking for ('../../mySDK_Folder/LibraryModule')

OR ('../mySDK_Folder/company-library/LibraryModule')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM