Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

Property 'extension.serviceAccountCredentials' does not exist. #808

Closed superdiazzz closed 4 years ago

superdiazzz commented 4 years ago

Describe the bug

I am new with CI/CD, so i following some step but got stuck in this step.

A clear and concise description of what the bug is.

How To Reproduce

Every commit project then push to Gitlab, and it return failed in pipeline in stage build_release_android

Versions

Tasks executed

Push data to remote repository (trigger CICD)

Expected behavior

A clear and concise description of what you expected to happen.

Additional context (if a crash, provide stack trace)

Add any other context about the problem here. If this bug is a crash, run the task with --stacktrace to get the full context.

> Task :app:validateSigningRelease
 > Task :app:packageRelease
 > Task :app:assembleRelease
 > Task :app:generateReleasePlayResources NO-SOURCE
 > Task :app:processReleaseMetadata SKIPPED
 > Task :app:publishReleaseApk FAILED
 FAILURE: Build failed with an exception.
 * What went wrong:
 A problem was found with the configuration of task ':app:publishReleaseApk'.
 > File '/builds/zulhija/kiwari-android-test/app/api-7196515771782491829-266529-a514570d0422' specified for property 'extension.serviceAccountCredentials' does not exist.
 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
 * Get more help at https://help.gradle.org
 BUILD FAILED in 5m 16s
 37 actionable tasks: 37 executed
Running after_script
00:01
Uploading artifacts for failed job

My gradle looks like

buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        jcenter()
        mavenCentral()
        google()
        maven{url 'https://oss.sonatype.org/content/repositories/snapshots'}

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
        // in the individual module build.gradle files
        classpath 'com.github.triplet.gradle:play-publisher:2.0.0-SNAPSHOT'

    }
}
allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and app.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-kapt'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.github.triplet.play'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.ngerancang.kiwariandroidtest"
        minSdkVersion 19
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    signingConfigs {
        release {
            // You need to specify either an absolute path or include the
            // keystore file in the same directory as the build.gradle file.
            storeFile file("kiwaritest.jks")
            storePassword "123456789"
            keyAlias "kiwari"
            keyPassword "123456789"
        }
    }

    dataBinding {
        enabled = true
    }

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

play {
    track = 'alpha' // set track for playstore  like 'production','beta','alpha'
    serviceAccountEmail = 'kiwaritest@api-7196515771782491829-266529.iam.gserviceaccount.com' //paste your service account email
    //jsonFile = file('/PlayJson/play-store-key.json') // copy this line as it is do not modify
    serviceAccountCredentials = file("api-7196515771782491829-266529-a514570d0422")
}

Please help me

SUPERCILEX commented 4 years ago

The file doesn't exist 🤷‍♂️. You maybe meant serviceAccountCredentials = file('/PlayJson/play-store-key.json').

superdiazzz commented 4 years ago

The file doesn't exist 🤷‍♂️. You maybe meant serviceAccountCredentials = file('/PlayJson/play-store-key.json').

I have changed it to serviceAccountCredentials = file('/PlayJson/play-store-key.json') now return error

Json credentials cannot specify a Service Account email

SUPERCILEX commented 4 years ago

Remove serviceAccountEmail.

superdiazzz commented 4 years ago

Remove serviceAccountEmail.

Thank you for quick response. I have removed serviceAccountEmailBut, now i have new error build file '/Users/tribunonline/Desktop/DEVELOPMENT/KOTLIN/KiwariAndroidTest/app/build.gradle' line: 50 A problem occurred evaluating project ':app'.

Could not set unknown property 'jsonFile' for object of type com.github.triplet.gradle.play.PlayPublisherExtension.

SUPERCILEX commented 4 years ago

Remove the line with jsonFile.

superdiazzz commented 4 years ago

Remove the line with jsonFile.

Thank you, Build Success

SUPERCILEX commented 4 years ago

Cool. BTW, I'd highly recommend using the latest version (2.7.5) and not plain 2.0.0.

superdiazzz commented 4 years ago

@SUPERCILEX Okay, i will change it later. Btw, can you help me, what this error mean? it was the result of my pipeline Screen Shot 2020-05-01 at 13 58 16

SUPERCILEX commented 4 years ago

It means that you didn't create an app with that package name in the play console. Or that your credentials don't have access.

superdiazzz commented 4 years ago

Okay, thankyou man