We created an Android app with a webview which shows a local website from the assets folder.
The project has different Product Flavors to generate diffent apps with
I finaly have the solution!
Add this to your build.gradle in the main folder (not of your app):
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'http://dl.bintray.com/robfletcher/gradle-plugins' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.robfletcher:compass-gradle-plugin:2.0.6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Add this the build.gradle of the app module:
apply plugin: 'com.android.application'
apply plugin: 'com.github.robfletcher.compass'
android {
[..]
android.applicationVariants.all { variant ->
for (output in variant.outputs) {
def assetsDir = output.packageApplication.assets;
tasks["merge${variant.name.capitalize()}Assets"].doLast() {
println "Assets folder: " + assetsDir
def _ccsDir = file("$assetsDir/css")
def _sassDir = file("$assetsDir/sass")
def _imagesDir = file("$assetsDir/images")
def _javascriptsDir = file("$assetsDir/js")
def _fontsDir = file("$assetsDir/fonts")
project.compass {
cssDir = _ccsDir
sassDir = _sassDir
imagesDir = _imagesDir
javascriptsDir = _javascriptsDir
fontsDir = _fontsDir
}
//compileSass
project.compassCompile.execute()
}
}
}
}
I never thought it would work out but it works!