我在项目中使用./gradlew assembleRelease crashlyticsUploadDistributionRelease --stacktrace
命令时遇到了麻烦。
很久以前,这个项目被添加到了Crashlytics。当手动拖放apk时上传工作正常,但运行此命令会给我
这个错误:
org.gradle.execution.TaskSelectionException: Task 'crashlyticsUploadDistributionRelease' not found in root project 'myapp-mobile-android-base'.
at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:101)
at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:76)
at org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:42)
at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:44)
at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:47)
at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:44)
at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
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)
说明
我的清单中有这个标签:
<meta-data
android:name="io.fabric.ApiKey"
tools:replace="android:value"
android:value="81352c31e84be4cd38eb7b760a39d6ca111111" />
在gradle文件中:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenLocal()
maven { url "http://cloudant.github.io/cloudant-sync-eap/repository" }
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven {
url 'https://maven.fabric.io/public'
}
jcenter()
maven {
credentials {
username NEXUS_USERNAME
password NEXUS_PASSWORD
}
url MAVEN_REPO_BASE_SDK_URL
}
maven {
credentials {
username NEXUS_USERNAME
password NEXUS_PASSWORD
}
url MAVEN_REPO_CORE_SDK_URL
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
}
defaultConfig {
applicationId "com.myapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 15
versionName "2.0.4"
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
production {
java.srcDirs = ['src/production/java']
res.srcDirs = ['src/production/res']
}
staging {
java.srcDirs = ['src/staging/java']
res.srcDirs = ['src/staging/res']
}
}
productFlavors {
production {
multiDexEnabled true
applicationId "com.myapp"
versionCode 40
versionName "2.5.17"
}
staging {
multiDexEnabled true
applicationId "com.myapp_beta"
versionCode 162
versionName "2.5.17"
}
}
signingConfigs {
releaseMyapp {
storeFile file("myapp.keystore")
storePassword "myapp2015"
keyAlias "myapp"
keyPassword "myapp"
}
}
dexOptions {
javaMaxHeapSize "4g"
incremental true
}
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.releaseMyapp
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
def version = variant.productFlavors.get(0).versionName;
def versionCode = variant.productFlavors.get(0).versionCode;
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "myapp-${variant.name}-${version}(${versionCode}).apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
lintOptions {
abortOnError false
checkReleaseBuilds false
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.1.1'
}
}
dependencies {
compile 'com.myapp:myapp-core:2.2.5@aar'
compile 'com.myapp:myapp:3.2.0@aar'
compile 'com.android.support:support-annotations:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.cloudant:cloudant-sync-datastore-core:0.14.0'
compile 'com.cloudant:cloudant-sync-datastore-android:0.14.0'
compile 'com.cloudant:cloudant-sync-datastore-javase:0.14.0'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.google.code.gson:gson:2.4'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'net.orange-box.storebox:storebox-lib:1.3.0'
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'com.jaredrummler:android-device-names:1.0.8'
compile 'com.jakewharton.hugo:hugo-annotations:1.2.1'
compile 'com.fernandocejas.frodo:frodo-api:0.8.1'
compile 'io.reactivex:rxjava:1.1.1'
compile 'io.reactivex:rxandroid:1.1.0'
}
修改
我使用./gradlew assembleRelease crashlyticsUploadDistributionProductionRelease --stacktrace命令修复了它,但我的新apk也没有出现在crashlytics中。