Coder Social home page Coder Social logo

eventonehq / apkup Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 12.0 1.08 MB

๐Ÿš€ Publish APKs to Google Play directly from the terminal

Home Page: https://oss.eventone.page/apkup

License: MIT License

JavaScript 3.92% TypeScript 96.08%
android apk google google-play hacktoberfest mobile play upload

apkup's People

Contributors

c-h- avatar dependabot[bot] avatar jeduan avatar jpike88 avatar nprail avatar vacxe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apkup's Issues

Improve Google Play authentication docs

@nprail As already stated in #15, the flow for creating the service account has changed a bit. There is no rule Release manager anymore, or I'm unable to find it... I'm unable to get it going, it says ERROR: Forbidden.

Any help would be really much appreciated!

AAB support

I just learned about the Android App Bundle (AAB) format. It is a new (2017) Android app format that improves app download sizes. apkup should support that file type since it is "the future of Android."

And that also means that the name apkup isn't fully representative of what it actually does anymore...

  • Find or build an AAB parser (to extract the package ID and version code from the file)
  • Add AAB option to upload and promote

Links / Ref

I couldn't able to upload APK into play store using apkup

apkup --key /Users/aadav/Downloads/api-4948262631111429462-491123-f930deadbd92.json --track alpha --apk /Users/aadav/AndroidStudioProjects/ABCD/app/release/app-release.apk
When I try to execute this command, I'm getting the below issue.
ERROR: Only releases with status draft may be created on draft app.

It works fine, when I use playup for uploading
playup -a /Users/aadav/Downloads/api-4948262631111429462-491123-f930deadbd92.json -t beta /Users/aadav/AndroidStudioProjects/ABCD/app/release/app-release.apk

Do not define a valid '.' target

Package exports for '/usr/local/lib/node_modules/apkup/node_modules/uuid' do not define a valid '.' target

This issue begins from ~3 days ago. Any guess?

Forbidden

error stack:

"Error: Forbidden
at Gaxios._request (/home/sravan/data/publish-play/node_modules/gaxios/build/src/gaxios.js:85:23)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async JWT.requestAsync (/home/sravan/data/publish-play/node_modules/apkup/node_modules/google-auth-library/build/src/auth/oauth2client.js:346:18)"

Upload multiple APKs at once

Google started rejecting uploads of just 32 bit apk's (they also require 64). Is there a way to upload both a 32 and 64 apk's at the same time so Google will accept it?

Client cannot be set in Apkup class

By some reason "this" is undefined in Apkup class and when this.client = new googleapis_1... is used it breaks and throw an error:

Cannot set property 'client' of undefined

Anyone is experiencing this issue too? I am using the latest version(1.2.0).

you're a legend

just want to say you're awesome for this fork. google toolchain makes me want to commit seppuku and this just made my day.

`Internal error encountered` at the commit stage

The npm worked successfully on Jul 11. When I'm trying to upload an aab file, the issue occurs at the commit stage. Please see the log. The app file can be dragged and dropped manually to google play console.

  apkup:helpers > Parsing manifest +0ms
  apkup:helpers > File path /Users/testuser/projects/testapp/android/app2026020042.aab +1ms

  apkup:helpers > Detected package name com.testbundle +360ms
  apkup:helpers > Detected version code 2026020042 +0ms
  apkup:Edit > Authenticating +0ms
  apkup:Edit > Authenticated successfully +126ms
  apkup:Edit > Creating edit +1ms
  apkup:Edit > Created edit with id 01646419728668676158 +945ms
  apkup:Upload > Uploading release +0ms
  apkup:Upload > Uploaded ./android/app2026020042.aab with version code 2026020042 and SHA1 4a0f323350d524bdf3514fb6b6b730c24254ca42 +26s
  apkup:Upload > Assigning APK to internal track +1ms
  apkup:Upload > Assigned APK to internal track +565ms
  apkup:Upload > Uploading deobfuscation +0ms
  apkup:Edit > Commiting changes +27s
GaxiosError: Internal error encountered.
    at Gaxios._request (/Users/testuser/projects/testapp/node_modules/gaxios/build/src/gaxios.js:129:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async JWT.requestAsync (/Users/testuser/projects/testapp/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18) {
  response: {
    config: {
      url: 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.testbundle/edits/01646419728668676158:commit',
      method: 'POST',
      userAgentDirectives: [Array],
      paramsSerializer: [Function (anonymous)],
      headers: [Object],
      params: {},
      validateStatus: [Function (anonymous)],
      retry: true,
      responseType: 'json',
      retryConfig: [Object]
    },
    data: { error: [Object] },
    headers: {
      'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
      'cache-control': 'private',
      connection: 'close',
      'content-encoding': 'gzip',
      'content-type': 'application/json; charset=UTF-8',
      date: 'Sat, 12 Nov 2022 01:06:47 GMT',
      server: 'ESF',
      'transfer-encoding': 'chunked',
      vary: 'Origin, X-Origin, Referer',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'SAMEORIGIN',
      'x-xss-protection': '0'
    },
    status: 500,
    statusText: 'Internal Server Error',
    request: {
      responseURL: 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.testbundle/edits/01646419728668676158:commit'
    }
  },
  config: {
    url: 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/comcom.testbundle/edits/01646419728668676158:commit',
    method: 'POST',
    userAgentDirectives: [ [Object] ],
    paramsSerializer: [Function (anonymous)],
    headers: {
      'x-goog-api-client': 'gdcl/5.1.0 gl-node/16.16.0 auth/7.14.1',
      'Accept-Encoding': 'gzip',
      'User-Agent': 'google-api-nodejs-client/5.1.0 (gzip)',
      Authorization: 'Bearer ya29.c.b0Aa9VdynnGQMw4AysJw-I2kMnvm8LmLwLaJrFoAW_34ANhGdqakMd0aE0SEqVa36RjKHs6DkRsUN0YbltuunvYn3Xfy8Bt3EB4LY-sVIoiHX-DdNiOxbM8a7hRu-nNMYhvB4w0lbCtEykTwlWiUi8LZU_Vcyjm9PxL2fRJYwAWnSdj49vaFU2bamUeBZMZrsydk4_OM-QSMnLA_5-B8j1MaMneAf5qB4........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................',
      Accept: 'application/json'
    },
    params: {},
    validateStatus: [Function (anonymous)],
    retry: true,
    responseType: 'json',
    retryConfig: {
      currentRetryAttempt: 0,
      retry: 3,
      httpMethodsToRetry: [Array],
      noResponseRetries: 2,
      statusCodesToRetry: [Array]
    }
  },
  code: 500,
  errors: [
    {
      message: 'Internal error encountered.',
      domain: 'global',
      reason: 'backendError'
    }
  ]
}

Add tests!

One thing that playup had which apkup doesn't have is automated tests. apkup should have automated tests too.

I've never written unit tests before. This might be a good project for me to start writing tests for but feel free to contribute tests as well.

Config File

To support AAB upload (#4), reduce dependencies (adbkit-apkreader), and reduce command line parameters, a configuration file should be created. The config file should have a few static options including the package ID and location of the key.

Proposal

Location: apkup.json/apkup.js or specified via --config opt

Schema:

module.exports = {
   "packageName": "io.event1.app", // ID of the Android package
   "key": "./auth.json" // path to the Google API key
}

Questions

  • Should the key option be the key itself or a path to the key? I'm thinking it should be the path so that secrets and config are not mixed.

Promote between tracks

Currently apkup can only upload to a track once. Then you have to manually promote the APK. It should be able to promote APKs between tracks.

Example:

apkup promote --apk android-debug.apk --track beta

Or maybe just by version code and package name:

apkup promote --package-name io.event1.app --version-code 67 --track beta

Or maybe both options.

Unable to install apkup dependency with yarn 1.22 but works ok with npm 8

Hi guys I'm trying to install apkup up on my React Native app. My app uses yarn to resolve npm dependencies.
However when I do yarn install on all my dependencies when the script reaches the 'apkup' part of the install it errors out.
It looks like its related to bundle tool.

error /Users/mike/app/node_modules/bundletool: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /Users/mike/app/node_modules/bundletool
Output:
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:1172:7)
    at getCachedBinary (/Users/mike/app/node_modules/bundletool/install.js:90:26)
    at setupBundletool (/Users/mike/app/node_modules/bundletool/install.js:111:22)
    at Object.<anonymous> (/Users/mike/app/node_modules/bundletool/install.js:128:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)

What's odd is this works ok when I try to install with npm v8.

ERROR: Only releases with status draft may be created on draft app

Hi! First of all, thank you very much for this tool.

I'm having an issue similar to #12.

I'm new to setting up apps in the Google Play Console. Right now the store listing and app config are not completed. However, I was able to manually create an "Internal testing" release yesterday:

image

I'm running this inside Docker and getting the result below:

#28 [upload-to-play 4/5] RUN apkup --version
#28 sha256:016d1c8b83d9855cc000f0d5eb017be5e98db60aebbd19c14c31cb585c8f4e66
#28 1.418 1.3.1
#28 DONE 1.4s

#29 [upload-to-play 5/5] RUN --mount=type=secret,id=service-account apkup     --key /run/secrets/service-account     --apk app-release.apk     --track internal
#29 sha256:219678f208b48000268e3ce738aaa25f4175cc4be2580f8e67505087aa8c65a8
#29 1.610 - Uploading APK...
#29 5.519 ERROR: Only releases with status draft may be created on draft app.

Also, please note that I haven't managed to install the test release on my phone yet. I joined the testing program via the link but Google Play crashes when I click the link to Play... Maybe I've been inpatient and just need to wait. But the error above is wouldn't be helpful in this case.

Any comment would be helpful.

Obb file for two APKs with different versionCodes not supported

First of all, this is a really great tool! Thanks for making and maintaining it!

I am trying to upload 2 APKs, one for armv7 and one for arm64. As per the android documentation, the versionCode for the arm64 is one more than for the armv7 (eg. armv7=10, arm64=11). I have an expansion file for each of them, which in theory could be the same, but they are two different in my case.

Either way, I have looked through the code, and it seems as though only the first apk file (based on versionCode) will receive the obb file. This is unfortunate as I would like to use apkup to serve both the 64bit audience, and the older 32bit users.

My code for reference.

   const apks = [
        `./artifacts/${config.projectName}-arm64.apk`,
        `./artifacts/${config.projectName}-armv7.apk`
    ]
    const obbs = [
        `./artifacts/main.${config.buildNumber + 1}.${config.androidPackageName}.obb`,
        `./artifacts/main.${config.buildNumber}.${config.androidPackageName}.obb`
    ]
    apkup
        .upload(apks, {
            obbs,
            releaseNotes: [
                {
                    language: 'en-US',
                    text: myUpdateText
                }
            ],
            track: 'internal'
        })
        .then(data => {
            console.log(` > ${data.packageName} version ${data.versionCode} is up!`);
        });

Not sure how easy or hard it would be, but perhaps it would be possible to create an apkObject of some sorts that has a list of related obb files inside it, which in my case might perhaps look something like this:

apkup.upload([
    {
        apkPath:  ./artifacts/${config.projectName}-arm64.apk`,
        obbs: [`./artifacts/main.${config.buildNumber + 1}.${config.androidPackageName}.obb`]
    },{
        apkPath: `./artifacts/${config.projectName}-armv7.apk`,
        obbs: [`./artifacts/main.${config.buildNumber}.${config.androidPackageName}.obb`]
    }], 
    {
        releaseNotes: [
                {
                    language: 'en-US',
                    text: myUpdateText
                }
        ],
        track: 'internal'
    })

From an implementation point of view the configs above could be added without breaking existing interfaces by doing something like the below (typescript syntax)

export interface apkSpecificationObject {
    apkPath: string,
    obbs?: string[]
}
function upload(apk: string | string[] | apkSpecificationObject | apkSpecificationObject[]) {
    let apkArray: (string | apkSpecificationObject)[] = []
    if(Array.isArray(apk)){
        apkArray = apk
    } else {
        apkArray = [apk]
    }
    apkArray = apkArray.map(apkInTransit => {
        if(typeof apkInTransit === 'string') {
            return {
                apkPath: apkInTransit
            } 
        } else {
            return apkInTransit
        }
    })
    // ... do whatever we need to do with the list of apkSpecificationObjects from this point on
}

apkup -h returns a non-zero code: 1

Hey there!

Thank you for the good work!

I wanted to run apkup -h during my docker build on continous integration. But it returns 1 which indicates an error to CI and let the build fail...

I think --apk and --key should not be tested when running -h.

Problem with a missing paramter?

I'm trying to upload a file to play store and I'm getting the following error:

npx apkup upload -k ./playstore_service_account.json -a $aabVersioned -t 'internal'
- Uploading APK...
ERROR: Changes cannot be sent for review automatically. Please set the query parameter changesNotSentForReview to true. Once committed, the changes in this edit can be sent for review from the Google Play Console UI.

Is there a problem with my code? this used to work in the past... probably a change in google store API?

Cannot set property 'client' of undefined

TypeError: Cannot set property 'client' of undefined
    at Apkup (c:\_...\node_modules\apkup\dist\index.js:65:21)

my gulp task

    var deployData = require('./.deployData.json');	
    const { Apkup } = require('apkup');
    const publisher = Apkup({
        client_email: deployData.clientEmail,
        private_key: deployData.privateKey
    });
...

i am 100% sure my auth is correct, as i was using the playup before and its still working
apkup its not, its giving me this error while creating the publisher

ERROR: Internal error encountered.

It seems that an error occurred while editing in the console.
'google.play.publishingapi.v3.EditsService.Commit' failed.
How about change the'--release-notes' argument optional?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.