问题
I have try with savillians-gradle and Triplet-T for publishing my apk to Play Store with gradle. However i got same issue in both way. I guess i might doing something wrong or there might be issue from both library. I don't know where is the problem.
I have configure everything as mention there i can able to build gradle successfully with both way.
Then i have try to upload apk file to play store but got error message.
- Please checck my below implementation and output for savillians gradle
I have execute gradle task as below:
gradlew androidPublish
With above command i got error message like below:
D:\Directory\myproject>gradlew AndroidPublish :buildSrc:compileJava UP-TO-DATE :buildSrc:compileGroovy :buildSrc:processResources UP-TO-DATE :buildSrc:classes :buildSrc:jar :buildSrc:assemble :buildSrc:compileTestJava UP-TO-DATE :buildSrc:compileTestGroovy UP-TO-DATE :buildSrc:processTestResources UP-TO-DATE :buildSrc:testClasses UP-TO-DATE :buildSrc:test UP-TO-DATE :buildSrc:check UP-TO-DATE :buildSrc:build
FAILURE: Build failed with an exception.
What went wrong: Failed to notify task execution graph listener.
com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode;
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 23.185 secs
- Please checck my below implementation and output for Triplet-T gradle
I have execute gradle task as below:
gradlew publishApkRelease
With above command i got error message like below:
D:\Directory\myproject>gradlew publishApkRelease :buildSrc:compileJava UP-TO-DATE :buildSrc:compileGroovy :buildSrc:processResources UP-TO-DATE :buildSrc:classes :buildSrc:jar :buildSrc:assemble :buildSrc:compileTestJava UP-TO-DATE :buildSrc:compileTestGroovy UP-TO-DATE :buildSrc:processTestResources UP-TO-DATE :buildSrc:testClasses UP-TO-DATE :buildSrc:test UP-TO-DATE :buildSrc:check UP-TO-DATE :buildSrc:build
FAILURE: Build failed with an exception.
What went wrong: Failed to notify task execution graph listener.
com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode; com.google.common.hash.HashCode.fromString(Ljava/lang/String;)Lcom/google/comm on/hash/HashCode;
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.9 secs
So, please help me for this issue. I need help to upload apk file to play store using gradle.
回答1:
That issue is resolved. I guess i have added the configuration and other task within wrong manner. So, because of that, it is first looking for the release apk file to upload even it is not build. Because of that I might got issue.
But, after configuring all with in separate tasks (First Build then release), its working great.
Below is my gradle.build file. It might help others if anyone getting same problem.
//-------------------------------------------------------------
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.your_package.your_project"
minSdkVersion 14
targetSdkVersion 20
versionCode 10
versionName "0.0.9"
}
signingConfigs {
release {
storeFile file("C:\PATH_FOR_KEYSTORE\YOUR_KEYSTORE.keystore")
storePassword "KEYSTORE_PASSWORD"
keyAlias "KEYSTORE_ALIAS"
keyPassword "ALIAS_PASSWORD"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
debug {
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
// For the TRIPLET gradle demo
apply plugin: 'play'
buildscript {
repositories {
mavenCentral()
}
dependencies {
// ...
classpath 'com.github.triplet.gradle:play-publisher:1.0.2'
classpath 'com.google.guava:guava:18.0'
}
}
play {
serviceAccountEmail = 'randomNumber@developer.gserviceaccount.com'
pk12File = file('D:\someDirectory\MyProject\number.p12')
track = 'beta' // or 'beta' or 'alpha' or 'production'
}
dependencies {
// some required dependencies for the project library
}
Hope this will help others also and save their time when they got such issue.
Enjoy Coding... :)
来源:https://stackoverflow.com/questions/28560205/failure-build-failed-with-an-exception-while-uploading-apk-with-savillians-gra