Showing posts with label gradle. Show all posts
Showing posts with label gradle. Show all posts

Friday, April 29, 2016

GRALDE - add custom external *.jar to module dependencies

1. An example is map-visualiser project from github
2. Clone that project and make gradlew build for it
3. It will build its *.jar inside of /build/libs
4. Create libs dir inside your module
5. Copy/past that *.jar into your module libs dir 
6. Add these LOCs below into module's build.gradle and build the project:

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'    
    }
}

dependencies {    
    compile name: 'map-visualiser-1.0'
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

Friday, January 29, 2016

GRADLE & NODE NPM - gradle task for execute npm install and bower install

https://gist.github.com/spikeheap/8558786

import org.gradle.api.tasks.Exec
defaultTasks 'bower'
// Get the path for the locally installed binaries
task npmBin << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'npm'
args = ['bin']
standardOutput = os
}
ext.binPath = os.toString().trim() + "/"
}
}
// Install packages from package.json
task npm(type: Exec) {
description = "Grab NodeJS dependencies (from package.json)"
commandLine = ["npm", "install"]
inputs.file "package.json"
outputs.dir "node_modules"
tasks.npmBin.execute()
}
// Install the bower components for front-end library management
task bower(dependsOn: 'npm', type: Exec){
commandLine "${npmBin.binPath}bower", 'install'
}

Friday, December 11, 2015

GRADLE - delete whole directory with all subdirectories

Override clean task:

clean {
    delete += 'dist'
}

If you do like this it will remove all files but leaves empty sub-directories:(!!!!!!)
clean {
    delete += fileTree('someDir')
}
or
clean {
    delete += fileTree('someDir').include('**/*')
}

Saturday, February 1, 2014

LINUX UBUNTU 12.04 64-bit and Android SDK 32-bit issue - gradle: Cannot run program sdk build-tools android-4.4 aapt No such file or directory

If you got this kind of error during the building of Android app: Execution failed for task mergeDebugResources Cannot run program sdk build-tools android-4.4 aapt No such file or directory -- this happen because you run Android SDK 32-bit on Linux Ubuntu 12.04 64-bit.

You can fix it easily by installing this libraries:
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1

More about this issue here:
http://askubuntu.com/questions/147400/problems-with-eclipse-and-android-sdk
http://stackoverflow.com/questions/18928164/android-studio-cannot-find-aapt