Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
791 views
in Technique[技术] by (71.8m points)

android - Task 'publishApkRelease' not found in root project

Im trying to configure gradle-play-publisher in my project, I have configured play block in build.gradle(Module: app), here's my build.gradle(Module:app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0 rc2"

    defaultConfig {
        applicationId "com.***.***"
        minSdkVersion 11
        targetSdkVersion 21

        ndk {
            moduleName "mupdf"
        }
    }

    signingConfigs {
        release {
            storeFile file("./***")
            storePassword "***"
            keyAlias "***"
            keyPassword "***"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            signingConfig signingConfigs.release
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }

    sourceSets.main {
        jniLibs.srcDir 'app/src/main/jniLibs'
        jni.srcDirs = []
    }

    lintOptions {
        abortOnError false
    }
}

apply plugin: 'com.github.triplet.play'
//apply plugin: 'play'

play {
    serviceAccountEmail = '***@developer.gserviceaccount.com'
    pk12File = file('./***.p12')
}

dependencies {
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:+'
}

Here's my build.gradle (Project)

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.github.triplet.gradle:play-publisher:1.1.1'
        classpath 'com.google.guava:guava:18.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Im getting following exception on running ./gradlew publishApkRelease --stacktrace :

    * Exception is:
    org.gradle.execution.TaskSelectionException: Task 'publishApkRelease' not found in root project '***'.
        at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:101)
        at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:76)
        at 
...
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

How to fix it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Looks like the task is not found in the root project. Have you tried

./gradlew app:publishApkRelease

instead?

Btw, you can run

./gradlew tasks

to see all the available tasks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...