I am trying to import a project as a library in android studio. I configured the build.gradle and the setting folder but I kept getting an error message saying that the configuration with the name default was not found. After doing research I found out that, the library requires a build.gradle folder. How do I add a build .gradle folder ? Please help me out.
Asked
Active
Viewed 312 times
3 Answers
1
You should have this type of structure:
root
build.gradle
settings.gradle
lib
build.gradle
app //optional
build.gradle
In settings.gradle
:
include ':lib' , ':app'
In lib/build.gradle
something like this:
apply plugin: 'com.android.library'
repositories {
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion 22.0.1
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionName 1
versionCode 1
}
}
In app/build.gradle
something like this:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion 22.0.1
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionName 1
versionCode 1
}
}
dependencies {
compile project(':lib')
}

Gabriele Mariotti
- 320,139
- 94
- 887
- 841
0
Can you import your project as gradle project in Android Studio? Per default, every new project has a gradle file. This file only is missing, when you are coding without android studio.

Tobias S
- 1,275
- 8
- 23