Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Task 'install' is ambiguous in root project 'TestApp'. Candidates are: 'installDebug', 'installDebugAndroidTest'

I am working on one library project in android. I want to upload my library to the JCenter. I have created bintray account etc & followed all steps which are mentioned here http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

I did below changes in my application module & library module.

Application Module build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"


    defaultConfig {
        applicationId "com.app.testapp"
        minSdkVersion 8
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
    }


}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile project(':testlib')
}

Library Module build.gradle

apply plugin: 'com.android.library'

ext {
    bintrayRepo = 'maven'
    bintrayName = 'test-sdk'

    publishedGroupId = 'in.test.sdk'
    libraryName = 'testlib'
    artifact = 'test-sdk'

    libraryDescription = 'A wrapper for Facebook Native Like Button (LikeView) on Android'

    siteUrl = 'https://github.com/xyz/testsdk'
    gitUrl = 'https://github.com/xyz/testsdk.git'

    libraryVersion = '1.0.0'

    developerId = 'xyz'
    developerName = 'xyz'
    developerEmail = '[email protected]'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}

version = "1.0.0"
android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 22
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
        release {
            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
           // proguardFiles 'proguard-project.txt'
        }
        packagingOptions {
            exclude 'META-INF/LICENSE.txt'
        }
    }


}

dependencies {
    compile 'com.android.support:support-v4:22.2.0'
    compile files('libs/gson-2.3.1.jar')
    compile files('libs/android-query-full.0.26.8.jar')
    compile files('libs/httpmime-4.1.1.jar')
    compile files('libs/jackson-annotations-2.5.0.jar')
    compile files('libs/javax.annotation.jar')
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/okhttp-2.3.0.jar')
    compile files('libs/okio-1.3.0.jar')
    compile files('libs/retrofit-1.9.0.jar')
}

Project root build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.3'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
        classpath 'com.github.dcendents:android-maven-plugin:1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }


}

allprojects {

    repositories {
        jcenter()
    }
}

When I am doing this gradlew install then I am getting this error

FAILURE: Build failed with an exception.

* What went wrong:          
Task 'install' is ambiguous in root project 'TestApp'. Candidates are: 'installDebug', 'installDebugAndroidTest'.

* Try:                      
Run gradlew 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.

BUILD FAILED                

Total time: 11.685 secs   

I spent three days on same but could not get proper solution of it. Please suggest how to resolve it.

like image 713
user1986760 Avatar asked Aug 27 '15 07:08

user1986760


1 Answers

Perhaps you forgot to add these lines to the end of your Library Module build.gradle:

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
like image 100
D.M. Avatar answered Sep 23 '22 15:09

D.M.