Reputation: 137
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.
Upvotes: 1
Views: 395
Reputation: 363429
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')
}
Upvotes: 1
Reputation: 1275
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.
Upvotes: 0