I'm getting this error in console while building my android project. Please help me understand this.
Messages:
Error:FAILURE: Build failed with an exception.
What went wrong:
Task 'prepareReleaseUnitTestDependencies' not found in project ':app'.
Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Gradle:
buildscript
{
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
//subprojects are added here
project(':external:calendar') {
apply plugin: 'android-library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}
project(':external:colorpicker') {
apply plugin: 'android-library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
}
project(':external:datetimepicker') {
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}
project(':external:timezonepicker') {
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
}
}
lintOptions {
abortOnError false
}
}
}
project(':external:chips') {
apply plugin: 'android-library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile project(':external:calendar')
compile project(':external:colorpicker')
compile project(':external:datetimepicker')
compile project(':external:timezonepicker')
compile project(':external:chips')
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
}
useLibrary 'org.apache.http.legacy'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'external/ex/common/java'] // NOTE: this includes external/ex/common/java!
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
/*
* To sign release build, create file gradle.properties in ~/.gradle/ with this content:
*
* signingStoreLocation=/home/key.store
* signingStorePassword=xxx
* signingKeyAlias=alias
* signingKeyPassword=xxx
*/
if (project.hasProperty('signingStoreLocation') &&
project.hasProperty('signingStorePassword') &&
project.hasProperty('signingKeyAlias') &&
project.hasProperty('signingKeyPassword')) {
println "Found sign properties in gradle.properties! Signing build…"
signingConfigs {
release {
storeFile file(signingStoreLocation)
storePassword signingStorePassword
keyAlias signingKeyAlias
keyPassword signingKeyPassword
}
}
buildTypes.release.signingConfig = signingConfigs.release
} else {
buildTypes.release.signingConfig = null
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
task customClean(type: Delete) {
delete rootProject.buildDir
}
clean.dependsOn customClean
perhaps you need to delete " -x prepareReleaseUnitTestDependencies" from :
Setting / build,execution, deployment/ compiler/ command-line Options
.
Related
I have a problem. When I want do Gradle project sync in my project, he write:
Error:Configuration with name 'debug' not found.
Only this one line, nothing more.
I don't know what he want from me.
Here is build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
apply plugin: 'android-library'
ext {
apply from: 'cordova.gradle'
cdvCompileSdkVersion = privateHelpers.getProjectTarget()
cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
targetSdkVersion 24
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
I started to experence the error since I had updated cordova-android to 6.0.0.
I overcame it by using
android {
publishNonDefault true
}
You can read about it here http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication
i added facebook sdk and AndroidMidi and i think i did it ok including dependencies and add model dependency on project structure
that is my build file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
}
apply plugin: 'android'
dependencies {
compile project(':facebook')
compile project(':AndroidMidi')
}
repositories {
jcenter()
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
}
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')
}
}
i can't get it running,
i get this error:
Error:Execution failed for task ':packageDebug'.
Failed to seal APK,
help?
EDIT
thats settings.gradle
include ':facebook', ':AndroidMidi'
stacktrace log returns:
:packageDebug Failed and same error
not enough rep to upload picture
Removing the file MidiPlayer/src/META-INF/MANIFEST.MF fixed it for me.
See: https://github.com/tkirshboim/btmidi/commit/7486ccbf17a6c2c36ef642bfb03fb9e13352c369
I am using Robotium for my test case. When i am using eclipse for run a test case it is working and showing 2 fail result but when i am using gradle for test case it is showing BUILD SUCCESSFUL.But in my code 2 fail results.
I am using this command - gradle clean connectedCheck build
My build.gradle file--
buildscript { repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.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']
}
instrumentTest.setRoot('MyTestCase')
instrumentTest {
java.srcDirs = ['MyTestCase/src']
manifest.srcFile file('MyTestCase/AndroidManifest.xml')
resources.srcDirs = ['MyTestCase/src']
res.srcDirs = ['MyTestCase/res']
assets.srcDirs = ['MyTestCase/assets']
}
}
dependencies {
compile files('libs/android-support-v4.jar')
}
lintOptions {
abortOnError false
}
}
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 !
I'd appreciate any help with this since I'm a noobie w/ gradle. I've got a build script with multiple buildTypes, but it appears settings for one of them are overwriting the others.
Here's my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android'
dependencies {
compile project(':facebook-android-sdk-3.0.1:facebook')
compile project(':google-play-services_lib')
compile project(':nineoldandroids')
compile project(':SlidingMenu-master:library')
compile project(':ViewPagerIndicator')
compile project(':volley')
compile project(':windowed-seek-bar')
compile files('compile-libs/androidannotations-2.7.1.jar', 'libs/Flurry_3.2.1.jar', 'libs/google-play-services.jar', 'libs/gson-2.2.4.jar', 'libs/picasso-1.1.1.jar', 'libs/crittercism_v3_0_11_sdkonly.jar', 'libs/gcm.jar', 'libs/apphance-library.jar')
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
signingConfigs {
debug {
storeFile file('keystores/debug.keystore')
}
release {
storeFile file('keystores/release.keystore')
storePassword "***"
keyAlias "***"
keyPassword "***"
}
}
buildTypes {
debug {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'normal']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
release {
signingConfig signingConfigs.release
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src', 'normal']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
utest {
debuggable true
signingConfig signingConfigs.debug
sourceSets {
main {
manifest.srcFile 'utest/AndroidManifest.xml'
java.srcDirs = ['src', 'utest']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
}
}
The settings for utest are overriding the settings for release and debug. Anybody know why?
Your usage of source sets is wrong. It is not inside each build type closure. They are declared on their own:
android {
buildTypes {
debug {
...
}
release {
...
}
utest {
...
}
}
sourceSets {
debug {
...
}
release {
...
}
utest {
...
}
}
}
Note that the build types have their own source sets on top of the 'main' source sets. So you shouldn't set all the build type sourceset to use 'src'. You could do
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
utest {
manifest.srcFile 'utest/AndroidManifest.xml'
java.srcDirs = ['utest']
}
}
}
Note that in this case the manifest under utest/AndroidManifest.xml will be merged in the main manifest.