I need to be able to import all of our projects in android studio and i need to be able to import just a single project, and its dependencies, into android studio.
Current project structure:
I can import the branch/Apps/build.gradle
fine and it imports all the projects under Apps
and compiles all the projects in settings.gradle
and works fine. However, i also need to be able to import just one project, and its dependencies, into android studio and it work fine.
Right now when i try to import the branch/Apps/Project1/build.gradle
Android studio gives the following error:
You are using an old, unsupported version of Gradle. Please use version 1.8 or greater.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
How can i import a single project and have it use the gradle wrapper that the MASS import of all the projects is using? Or is there a better way to handle this situation? Maybe i am just doing it completely wrong.
This effects Android Studio Version is 0.3.7 and 0.4.0.
Thanks
Android Studio expects to see a settings.gradle
file at the root directory of its project, and likes to have the Gradle wrapper files at the root as well. If you're trying to open, say, Project1 as an independent project, that's the problem you're running into -- neither of those things is in Project1's directory. If Project1 is just a module in the larger Apps project, those things aren't necessary.
What are you trying to do? Maybe there's a better approach rather than opening a subproject independently.
EDIT:
It works for me if I copy the Gradle wrapper files (gradlew
, gradlew.bat
, and the gradle
directory) into the subproject's directory, and also add a settings.gradle
file that looks like this:
include ':'
Here's a screenshot of my project's layout, where I've edited LibA to be able to be opened independently:
Note that if your subprojects have dependencies on each other (e.g. Project1 depends on Project2), then this scheme isn't going to work. Right now Android Studio would only understand that in the context of a larger project with a root directory that can encompass all dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With