I use this techique: I set this in my settings.gradle
include 'andengine'
project(':andengine').projectDir = new File(settingsDir, '../relative/path/to/andengine')
that is in the root directory of the project (I think gradle has already created it for your main project).
In AndEngine use a build.gradle
like the following for the AndEngine project
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
and add in the dependencies of your project
compile project(':andengine')
Maybe you have to close and reopen Android Studio, but normally for me this works.
BTW after have write the answer I see that someone has opened a pull request for a gradle build file.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…