Import multiple projects and individual projects into Android Studio

I need to be able to import all our projects into Android studio, and I need to be able to import only one project and its dependencies into android studio.


Current project structure:

  • branch /
    • Applications /
      • Project1 /
        • build.gradle
      • Project2 /
        • build.gradle
      • Project3 /
        • build.gradle
      • build.gradle
      • settings.gradle
      • gradlew
      • gradlew.bat
      • gradle /
    • OtherStuff /

I can import the tag branch/Apps/build.gradle and it imports all the projects under Apps and compiles all the projects into settings.gradle and works fine. However, I also need to be able to import only one project and its dependencies into android studio, and it works great.

Right now, when I try to import the studio branch/Apps/Project1/build.gradle Android, you get 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 Gradle settings or in the project Gradle wrapper (if applicable.) 

How can I import a single project and does it use the gradle shell that the MASS import of all projects uses? Or is there a better way to handle this situation? Maybe I'm just doing it completely wrong.

This version of Android Studio is version 0.3.7 and 0.4.0.

thanks

+6
source share
2 answers

Android Studio expects to see the settings.gradle file in the root directory of its project and likes to have Gradle shell files in the root. If you are trying to open, say, Project1 as an independent project, the problem you are facing is none of these things are in the Project1 directory. If Project1 is just a module in a larger Apps project, this is not necessary.

What are you trying to do? Perhaps there is a better approach, rather than opening a subproject independently.

EDIT:

This works for me if I copy the Gradle shell files ( gradlew , gradlew.bat and the gradle directory) to the subproject directory, and also add the settings.gradle file, which looks like this:

 include ':' 

Here is a screenshot of my project layout where I edited LibA to be able to open independently:

Screenshot of Project view showing files in app and LibA directories

Please note that if your subprojects are dependent on each other (for example, Project1 depends on Project2), then this scheme will not work. Now Android Studio understands only in the context of a larger project with a root directory that can cover all the dependencies.

+2
source

It seems to me that you need to edit the gradle shell settings in gradle / wrapper / gradle -wrapper.properties and change the version of gradle to 1.8.

0
source

All Articles