在根项目中找不到任务“publishApkRelease”
Posted
技术标签:
【中文标题】在根项目中找不到任务“publishApkRelease”【英文标题】:Task 'publishApkRelease' not found in root project 【发布时间】:2015-07-16 08:49:15 【问题描述】:我正在尝试配置gradle-play-publisher 在我的项目中,我在 build.gradle(Module:app) 中配置了播放块,这是我的 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:+'
这是我的 build.gradle(项目)
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()
我在运行 ./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)
如何解决?
【问题讨论】:
你能成功运行./gradlew assembleRelease
吗?
这里是原始问题的链接github.com/Triple-T/gradle-play-publisher/issues/81
【参考方案1】:
看起来在根项目中找不到该任务。你试过了吗
./gradlew app:publishApkRelease
改为?
顺便说一句,你可以运行
./gradlew tasks
查看所有可用任务。
【讨论】:
以上是关于在根项目中找不到任务“publishApkRelease”的主要内容,如果未能解决你的问题,请参考以下文章
Android Studio 构建失败,“在根项目‘MyProject’中找不到任务’。”
在根项目中找不到 Android Studio 0.8 任务组合