There is a project on GitHub'e - a project and I need to connect it to my project.


Going the way described in some response to stackoverflow, I tried to connect the project like this:

File -> New -> Import Module -> Chose the folder with the source code of the project. To this, AS told me:

Select modules to import

In the imported project, build.gradle contains the line: apply plugin: "android-library"


Why doesn't Android Studio see the project as a module and how to connect it?


build.gradle (global) of my project:

 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

build.gradle (local) of my project:

 apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.rostislav.dugin.playdotaformoney" minSdkVersion 17 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.2.1' } 

build.gradle imported project (manually edited via notepad, so errors are not excluded):

 task wrapper(type: Wrapper) { gradleVersion = "1.8" } apply plugin: "com.android.library" buildscript { repositories { mavenCentral() } dependencies { // Android Gradle plugin. classpath 'com.android.tools.build:gradle:2.1.3' } } android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { minSdkVersion 17 targetSdkVersion 24 versionCode = "1" versionName = "0.1" } sourceSets { main { manifest.srcFile "AndroidManifest.xml" java.srcDirs = ["src"] res.srcDirs = ["res"] } } } repositories { mavenCentral() } dependencies { // Libs: // Android API lvl 8 compile group: "com.google.android", name: "android", version: "2.2.1" // GSON compile group: "com.google.code.gson", name: "gson", version: "2.2.2" } 

Module import screen:

enter image description here

  • one
  • @pavlofff, I tried to manually edit the file so that all the SDK version, build tools, etc. coincided - the error remained. - user189127
  • what mistake? There is nothing about the error in the question .. Have you done the second part of the answer too? only minSDKversion should match, and if the build tools in the projects are different, then both of them should be installed via the SDK Manager - pavlofff
  • @pavlofff, the error is the message Select modules to import . Yes, I did. But apparently, manual editing is not a good idea. Now I’ll open my AS and use the editor to change everything. - user189127
  • This inscription means - “choose a module for import”, this is not an error, but a suggestion of an action that you need to perform. In response to this "error" you need to specify where the project to be joined is - pavlofff

1 answer 1

Sure that apply plugin: 'android-library' ?

I look at my projects, I have apply plugin: 'com.android.library' modules apply plugin: 'com.android.library' in build.gradle

  • Changed manually in a notebook, but did not help. - user189127