Auto-upload app's APK and its details to Play Store

From this error from the latest tagged build, it shows the Android client needs to use Octokit to be able to deploy the Android client to the Play store.

GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3 (Octokit::Unauthorized)

I think this is wrapped in the gradle-play-publisher plugin, so if it’s the case then we should update the gradle files to match the latest version of the plugin, we might fix the error this way. But there are lots more possibilities on why this error comes up. Does anyone know a good solution to this?

cc @dkayiwa @raff @burke @shivtej @codepoet2017390 @deepak140596

@f4ww4z I have commented on Jira issue.

https://github.com/travis-ci/travis-ci/issues/8018 this looks the same Issue.

1 Like

@f4ww4z, one of the possible situations resulting in Bad Credentials is the revoking of the GITHUB_API_KEY (in .travis.yml file). Kindly check if the the key isn’t revoked. Most of the solutions to this problem was OAuth Token being revoked by the Admin.

According to the https://developer.github.com/v3 page,

Failed login limit

Authenticating with invalid credentials will return 401 Unauthorized :

1 Like

Good find by both of you. It looks like I will need to renew the GITHUB_API_KEY, given that I have the correct permissions.

1 Like

A new issue’s been created for this. Can be assigned to a collaborator.

This solution is working fine, but now I’m seeing that the APK file is not found. I was thinking of using a regex to find all the .apk files under the outputs/apk folder, as there is no more than 1. What is your input to this @vankineenitawrun @deepak140596 ?

@f4ww4z

Can you try adding this prefix to file /home/travis/build/openmrs/openmrs-contrib-android-client/openmrs-client and check if working?.

Or try adding quotes to file location and change as

file: "./openmrs-client/build/outputs/apk/openmrs-client-release.apk".

@f4ww4z, on my system for a custom app, the output for release folder is now at :
\app\release\app-release.apk

while for debug, the folder is at:
\app\build\outputs\apk\debug

Seeing at the travis.yml file, the search location for output file resembles the debug. But the release path is different. I think this is causing the search to fail.

Also in the build.sh file, there is no custom path defined to create or build the apk. Therefore the release build will be created at the default path.

I’ve filed a new issue for this. It should be clear at least for the release variant / tagged builds.

Thanks @f4ww4z. I have been digging into this for quite a while now. I tried creating a release version of OpenMRS and it was created by default in the folder
\openmrs-client\release\openmrs-client-release.apk .

There are two solutions to the above problem. But at first we should acknowledge that there are 2 different directories concerned. First is the Output Dir and second is the Search Dir. One solution will be changing the output dir and the second the solution (much easier) will changing the search dir.

I want some feedback on this.

We don’t necessarily have to change the default output dir, just need whatever the default dir and explicitly add it to the Gradle file and travis. What are you referring to by search dir? Any example we can see?

In the travis.yml file, after deploy line number 17 in this is where the search for the apk occurs.

We just need to change this file location to the default location.

Yes, this is a part of what I said before. So because sometimes Android changes the build dir for any variant, we can just specify the current one in build.gradle . Then we set the same location in yml line 17. See the link I gave in AC-585 .

@f4ww4z following this link @deepak140596 is correct we need to change the file location to

./openmrs-client/release/openmrs-client-release.apk.

or check with

/home/travis/build/openmrs/openmrs-contrib-android-client/openmrs-client/build/outputs/apk/openmrs-client-release.apk.

Hope either of one to be working.

Yup. We need to do that, as well as update the search dir.

Waiting for the tagged build: https://travis-ci.org/openmrs/openmrs-contrib-android-client/builds/521546744 . Thanks everyone.

I think we should add tree command in the travis.yml in the script after ./build.sh to debug and find where the APK builds.

Good work - See the APK at https://github.com/openmrs/openmrs-contrib-android-client/releases

1 Like

@f4ww4z Review this PR of Issue too. :smile:

@vankineenitawrun @f4ww4z, I found an issue regarding building of debug app. The debug app is now being built in the same space as the release build (openmrs-client/release/ .apk). Therefore Android Stuido is not being able to find the location of the debug app to install on device for testing purpose.

One solution will be to build the debug app and manually transfer the app to the device and install it for testing purpose. Second solution will be to change the default path in Android Studio to search and install for the debug app.

I don’t know if only I am facing this issue.