I am trying to import standout library which is a github project as library in my project.What i tried is below:
created a folder in my root project directory named 'libs'
- copied the complete folder 'library' of the Standout project on git into 'libs'
- renamed the folder 'library' that i just copied to e.g. "standout" (just to avoid confusion)
now added this library in my
settings.gradle
with the following command:include ':libs:standout'
going to my
build.gradle
file of my AppProject and added the following line to my 'dependencies':compile project(':libs:standout')
but i got error and then added like this
compile fileTree(dir: 'libs', include: ['standout'])
gradle sync was successful but there is red mark on the src files of the library project..
I couldn't access the library src files from MainActivity of my Project.As the github project wasn't the android studio project do i need to do anything extra for that?
I have tried below way suggested by Wesley:
Download or clone the git repository, copy the
library
folder into your project root folder.Then in your project
settings.gradle
file, add a':library'
at the end of the include line, like this:include ':app', ':library'
, thengradle sync
your whole project.At the end, in your
app module
or you own application module, edit thebuild.gradle
file, add a line in your dependencies:
compile project(':library')
BTW, you can change the folder name ("library" in this case) to any name you want (like "standout-library" if you want) when copy it into you project's root folder, then, when you edit the gradle files, just use the changed name.
But got the below error:
Error:Configuration with name 'default' not found.
My build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.mapandmap.standout"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':standout')
compile 'com.android.support:appcompat-v7:22.1.1'
}
My settings.gradle:
include ':app',':standout'
screenshot of my Project Tree: