Android, Gradle. How to build application and run tests from test application - android

I have android project and android test project inside it, located under folder tests. Structure of these project is eclipse like
+-src
| - res
| - libs
| - tests
|.....
I use gradle. All i want is to build app, run unit tests and get reports of them. But i don't understand how to do it right. I'm created build.gradle file in root folder
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
testPackageName "ua.cooperok.stringcalc.tests"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
unitTest {
java.srcDir file('tests/src')
resources.srcDir file('tests/res')
}
}
configurations {
unitTestCompile.extendsFrom runtime
unitTestRuntime.extendsFrom unitTestCompile
}
dependencies {
unitTestCompile files("$project.buildDir/classes/release")
}
task unitTest(type:Test){
description = "Run unit tests..."
testClassesDir = android.sourceSets.unitTest.output.classesDir
classpath = android.sourceSets.unitTest.runtimeClasspath
}
build.dependsOn unitTest
}
But when i run gradle build i got error
Could not find property 'output' on source set unit test.
Also, as i understand, to get reports i need to apply plugin "android-reporting", but when i do this i got error
Cannot add extension with name 'android', as there is an extension already registered with that name.
Should i do it like this, or i must create new gradle.build file in my test application project?
UPDATE
I fixed error with output, and made gradle build successful, but I don't understand what's goind on. I purposely failed my test, but gradle build is still successful.
What I've done:
1. I moved task unitTest from android section to root, after that, my test project began to compile, but there is an error 'packackage android.test not found'
2. To fix that error I added to classpath path to android sources, so after that gradle build was successful, but realy I don't understand why it's always successful even when test fails
And still I don't understand how to get reports from test
This is my new build.gradle file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
testPackageName "ua.cooperok.stringcalc.tests"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
sourceSets {
main {
manifest.srcFile file('AndroidManifest.xml')
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
}
sourceSets {
unitTest {
java.srcDirs = ['tests/src']
resources.srcDirs = ['tests/src']
}
}
configurations {
unitTestCompile.extendsFrom runtime
unitTestRuntime.extendsFrom unitTestCompile
}
dependencies {
unitTestCompile files("$project.buildDir/classes/release")
unitTestCompile 'junit:junit:4.11'
compile fileTree(dir: 'libs', include: '*.jar')
}
task unitTest(type:Test, dependsOn: assemble) {
description = "run unit tests"
testClassesDir = sourceSets.unitTest.output.classesDir
classpath = files("$System.env.ANDROID_HOME/sources/android-18")
//actualy I didn't get any report
getReports().getJunitXml().setOutputPerTestCase(true)
}
build.dependsOn unitTest

I found solution. I was dissapointed by few topics, and thought that i need to create separate task for unit tests. In fact it was prety easy.
I didn't change my project structure, just build.gradle file. To build application i run
gradle clean connectedCheck build
connectedCheck runs unit tests from my test project and if some test fails - gradle build will fails too
Here final version of it
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 18
buildToolsVersion "18.1.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
testPackageName "ua.cooperok.stringcalc.tests"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
sourceSets {
main {
manifest.srcFile file('AndroidManifest.xml')
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest {
java.srcDirs = ['tests/src']
manifest.srcFile file('tests/AndroidManifest.xml')
resources.srcDirs = ['tests/src']
res.srcDirs = ['tests/res']
assets.srcDirs = ['tests/assets']
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
//Signing apk
if(project.hasProperty("signingPropertiesPath")) {
File propsFile = new File(System.getenv('HOME') + "/" + project.property("signingPropertiesPath"))
if(propsFile.exists()) {
Properties props = new Properties()
props.load(new FileInputStream(propsFile))
//loading keystore properties
signingConfigs {
release {
storeFile file(propsFile.getParent() + "/" + props['keystore'])
storePassword props['keystore.password']
keyAlias props['keyAlias']
keyPassword props['keyPassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
}
}

Related

android studio gradle build Error Error:Execution failed for task ':packageAllDevDebugClassesForMultiDex'. >

I have been using Android Studios from eclipe becuse Multidex 65000 compile Error!!!!
i did sync project gradle in android studio from eclipse project
i have problem compile Error in android studio
Error:Execution failed for task
':packageAllDevDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: android/support/multidex/MultiDex$V14.class
--build.gradle--
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android
{
compileSdkVersion 18
buildToolsVersion "20.0.0"
defaultConfig{
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
productFlavors {
dev {
minSdkVersion 18
}
prod {
minSdkVersion 18
}
}
}
why problem occurring
i want this problem solve
help me error sovle please

Application Apk built with Android Studio is larger than one built with Eclipse

Recently I migrated my project to Android Studio. The project references a library project without copying it (See this answer).
I noticed that the apk generated from Android Studio is larger than the one generated from Eclipse (almost twice larger). When I unrar the two apk files I see that in the apk from Android Studio there is one more folder "main" and it contains "res" folder and AndroidManifest.xml.
The problem is that there is "res" folder (/res) in apk's main directory which contains the same resources (/main/res).
I think that the next gradle file causes the problem but without it the project can not be built.
build.gradle for my library module - my_android_project_lib module
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
}
// I think this duplicates the resources
sourceSets {
main {
manifest.srcFile 'my_android_project_lib/src/main/AndroidManifest.xml'
java.srcDirs = ['my_android_project_lib/src']
resources.srcDirs = ['my_android_project_lib/src']
aidl.srcDirs = ['my_android_project_lib/src']
renderscript.srcDirs = ['my_android_project_lib/src']
res.srcDirs = ['my_android_project_lib/src/main/res', 'slidingMenuLib/src/main/res']
assets.srcDirs = ['my_android_project_lib/src/main/assets']
}
}
}
dependencies {
compile project(':slidingMenuLib')
compile fileTree(dir: 'my_android_project_lib/libs', include: ['*.jar'])
compile fileTree(dir: 'slidingMenuLib/libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:1.7.1'
}
settings.gradle
include ':my_android_app'
include ':my_android_project_lib'
include ':slidingMenuLib'
project(':my_android_project_lib').projectDir = new File(settingsDir, '../my_android_project_lib')
build.gradle for my_android_app module
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "my.android.app"
minSdkVersion 15
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(path: ':my_android_project_lib')
}
build.gradle for my_android_app project
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Do you know how to fix the problem? I'm missing something important.
I found the problem. When I removed the following line from my build.gradle of my_android_project_lib module, application's size changed back to normal.
resources.srcDirs = ['anyoption_android_v2_lib/src']
The final build.gradle for my_android_project_lib module is:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
}
// The problem is here.
sourceSets {
main {
manifest.srcFile 'my_android_project_lib/src/main/AndroidManifest.xml'
java.srcDirs = ['my_android_project_lib/src']
res.srcDirs = ['my_android_project_lib/src/main/res']
// Removed
// resources.srcDirs = ['my_android_project_lib/src'] - MAIN PROBLEM
// aidl.srcDirs = ['my_android_project_lib/src']
// renderscript.srcDirs = ['my_android_project_lib/src']
// res.srcDirs = ['my_android_project_lib/src/main/res', 'slidingMenuLib/src/main/res']
// assets.srcDirs = ['my_android_project_lib/src/main/assets']
}
}
}
dependencies {
compile project(':slidingMenuLib')
compile fileTree(dir: 'my_android_project_lib/libs', include: ['*.jar'])
compile fileTree(dir: 'slidingMenuLib/libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:1.7.1'
}
on commenting
resources.srcDirs = ['src']
in build.gradle file, worked for me.
The SourceSets in build.gradle file looks like this,
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
// resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}

Unexpected node Android Packaging in Android Gradle build

I am trying to make my project use gradle. The problem is that everytime I try to build, I get the following error:
Error:Internal error: (java.lang.AssertionError) Unexpected node Android Packaging; nodes=[Module 'Serengeti' production, Resources for 'Serengeti' production, Resources for 'Serengeti' tests, Artifact 'Serengeti', gradle-resources-production:Serengeti, gradle-resources-test:Serengeti, Android Gradle Build Target]
java.lang.AssertionError: Unexpected node Android Packaging; nodes=[Module 'Serengeti' production, Resources for 'Serengeti' production, Resources for 'Serengeti' tests, Artifact 'Serengeti', gradle-resources-production:Serengeti, gradle-resources-test:Serengeti, Android Gradle Build Target]
at com.intellij.util.graph.GraphGenerator.buildOuts(GraphGenerator.java:55)
at com.intellij.util.graph.GraphGenerator.<init>(GraphGenerator.java:36)
at com.intellij.util.graph.GraphGenerator.create(GraphGenerator.java:40)
at org.jetbrains.jps.builders.impl.BuildTargetIndexImpl.initializeChunks(BuildTargetIndexImpl.java:86)
at org.jetbrains.jps.builders.impl.BuildTargetIndexImpl.getSortedTargetChunks(BuildTargetIndexImpl.java:50)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:610)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:352)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:191)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:131)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:229)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:158)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I have no idea what this means. I found this but it's not really helpful...
This is my build.gradle file. This is my first time using gradle so if there is anything wrong with this please point it out.
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.+'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
// http://gradleplease.appspot.com/
compile 'com.android.support:support-v4:20.+'
compile 'com.google.android.gms:play-services:+'
compile 'joda-time:joda-time:+'
compile 'com.googlecode.android-query:android-query:+'
compile 'me.dm7.barcodescanner:zbar:+'
compile 'com.github.asne.facebook:facebook:3.17.2'
compile('com.twitter.sdk.android:twitter:1.0.1#aar') {
transitive = true;
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
}
lintOptions {
abortOnError false
}
signingConfigs {
SignConfig {
keyAlias 'removed'
keyPassword 'removed'
storeFile file('removed')
storePassword 'removed'
}
}
buildTypes {
debug {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
release {
zipAlignEnabled
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
}
productFlavors {
RunConfig {
signingConfig signingConfigs.SignConfig
}
}
}
How can I fix this error?
Found the solution to this problem. If you go to Project Structure -> Modules -> <Your project> -> Android, you will notice that nothing loads. It will look like this:
In order to fix this, select Android and click Remove (the red dash above). Then click Add (the green plus above) and select Android. Click OK and the error should be gone now.

Build script error, unsupported Gradle DSL method found: 'release()'! when uograded to 0.5.1

Not able to solve this error, I have updated Android studio. gone throungh other this solutions but not worked for me, please help..
Build script error, unsupported Gradle DSL method found: 'release()'!
Possible causes could be:
- you are using Gradle version where the method is absent
- you didn't apply Gradle plugin which provides the method
- or there is a mistake in a build script
Gradle settings
Gradle version - 0.9
Main gradle.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
}
Project Gradle file
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion '18.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
signingConfigs {
release {
storeFile file('dsc.jks')
storePassword 'dscneo'
keyAlias 'dsc'
keyPassword 'dscneo'
}
}
buildTypes {
debug {
versionNameSuffix '-DEBUG'
}
beta {
versionNameSuffix '-BETA'
}
release {
signingConfig signingConfigs.release
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:3.1.36'
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:support-v4:+'
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/gson-2.1.jar')
compile project(':facebook')
compile project(':TabIndicatorLibrary')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile project(':VerticalViewPager')
compile files('libs/universal-image-loader-1.9.1.jar')
compile files('libs/universal-image-loader-1.9.1-sources.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile files('libs/HockeySDK-3.0.1.jar')
}
Facebook SDK gradle file
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
android {
compileSdkVersion 17
buildToolsVersion "18.0.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Other library project gradle file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
android {
compileSdkVersion 16
buildToolsVersion '18.0.1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
one more library project gradle file.
apply plugin: 'android-library'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
versionCode 1
versionName "1.0"
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
In your last file (library) you have the release block inside the android block.
The DSL for the library projects is now the same as for the application projects
In particolar you have to put the release block inside the buildTypes.
android {
buildTypes {
release {
}
}
Also I suggest you use buildToolsVersion '19.0.x' for all your gradle files.
You can put it in your build.gradle in root folder.
ext {
compileSdkVersion = 19
buildToolsVersion = "19.0.3"
}
Then in each build.gradle file you can use:
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

How to execute task in Gradle one by one

I have this gradle build file.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
classpath 'com.eriwen:gradle-css-plugin:1.2.1'
classpath 'com.eriwen:gradle-js-plugin:1.5.1'
}
}
apply plugin: 'android'
apply plugin: 'js'
apply plugin: 'css'
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/cordova-2.7.0.jar')
compile files('libs/libGoogleAnalyticsV2.jar')
}
task MinifyJSForRelease {
tasks.add(name:"copyTask2", type:Copy){
from 'assets/'
into 'build/minifiedassets/assets'
}
it.dependsOn copyTask2
def tester = fileTree(dir:"build/minifiedassets/assets", include:"**/*.js");
println tester
tester.eachWithIndex {File file, idx ->
tasks.add(name: "makeMinifyJS${idx}", type: com.eriwen.gradle.js.tasks.MinifyJsTask) {
source = file
dest = "${file.path}"
closure {
compilerOptions.languageIn = "ECMASCRIPT5"
}
}
}
it.dependsOn tasks.matching { Task task -> task.name.startsWith("makeMinifyJS")}
}
build.dependsOn MinifyJSForRelease
android {
compileSdkVersion 17
buildToolsVersion "17"
signingConfigs {
release {
storeFile file('keystores/mobilecoe_android.keystore')
storePassword "mobilecoe"
keyAlias "MobileCoE"
keyPassword "mobilecoe"
}
}
defaultConfig {
minSdkVersion 10
targetSdkVersion 16
}
buildTypes {
debug {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
release {
signingConfig signingConfigs.release
zipAlign true
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['build/minifiedassets/assets']
}
instrumentTest.setRoot('tests')
}
}
}
}
I Want to run the task MinifyJSForRelease like the first thing would be to copy the assets folder to where I want and then when that is finished I want to minify the JS files.
Now when I run the task it copies the folder but not reaching the end the next function says it has nothing to minify but if I run the task the second time(when the folder is already copied) it fiends it and does everything.
What am I do in wrong?
I need to:
copy folder
Get the folder and minify its js files
Could some one help me out?
I'm a total virgen to Gradle, So I can only provide you with educated guess:
unify the way you declare the dependencies
taskB.dependsOn tasksA
force the order of the task (in add of the dependency)
taskB.mustRunAfter(taskA)
add logs, to see if the task is executed VS the tasks does not do what you expect.
Adding dependencies to a task / Ordering tasks
http://www.gradle.org/docs/current/userguide/more_about_tasks.html
please, provide us with the solution once you got it !

Categories

Resources