Reputation: 15
I'm currently working on automating an android build via gradle but my build.gradle file isn't copying the entire res/ or assets/ dirs into my produced apk.
Clarification:
The contents of the needed res/
& assets/
dirs are copied into the apk, but the actual res/
and assets/
dirs are nowhere to be found. For this automation to match the manual process in place, I need a seemless transition from manual build process to automated build process. (no difference in produced apk)
I know it has to be how I'm addressing the sourceSets and resources, but I can't find any direction/advice on what I'm doing wrong.
Here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src','../res','../assets']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
defaultConfig {
applicationId "***************"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
zipAlignEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
zipAlignEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
My directory structure(loosely represented):
AppBase/
+res/
+assets/
-gradle files
+AndroidApp
+src/
-gradle files
Upvotes: 0
Views: 3089
Reputation: 191671
I think you should be doing something like this, though, I am not too sure about the relative paths.
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res','../res']
assets.srcDirs = ['assets', '../assets']
}
}
Upvotes: 2