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.11k stars 340 forks source link

Support for form factor #1088

Closed ibatica closed 3 months ago

ibatica commented 1 year ago

Problem description

Currenlty it is possible to upload only for phone/tablet form, "automotive" and "wear" forms are not support.

Potential solutions/workarounds

In order to support form factor by Android Publishing API track should be defined as wear:production" or "wear:beta", "automotive:internal" This doesn't work with current implementation.

Additional context

Android Publishing API track and form factor https://developers.google.com/android-publisher/tracks

JBassett commented 1 year ago

Are there any workarounds other than manually deploying?

markchristopherng commented 1 year ago

Hi, we also require this for our wear app where Google requires all wear apps to be on a seperate track by end of August 2023

https://support.google.com/googleplay/android-developer/answer/13295490?hl=en

sorinirimies commented 1 year ago

We have a wear app and since Google has started enforcing form factor publishing we can't use properly this plugin. A form factor option would really be great.

crysxd commented 1 year ago

Is there any workaround? We are kinda slowly approaching the deadline. I assume we need to enable the form factor track and then publish the wear app manually?

adrianolc commented 1 year ago

We're running into the same problem now. Is there any update on when it will be supported or any workaround to solve the issue?

SUPERCILEX commented 1 year ago

I'm not involved with the project anymore, but I still do PR reviews if people want to fix this.

damiafuentes commented 1 year ago

We're facing the same issue.

crysxd commented 1 year ago

I looked at this problem again as it has to be solved soon and now it seems to all work for me as expected.

What I did:

damiafuentes commented 1 year ago

Hey @crysxd , thanks for your input. I can't manage to make it work still. This is what we currently have, which seems to replicate your behavior above by adding wear: to the track:

build.gradle project level

buildscript {
    ...
    dependencies {
        ...
        classpath 'com.github.triplet.gradle:play-publisher:3.8.4'
    }
}

build.gradle mobile app level

apply plugin: 'com.github.triplet.play'

...

play {
    track = "internal"
    serviceAccountCredentials = file(GOOGLE_ACCOUNT_SERVICE_FILE)
    // Commit this build separately from the wear build.
    commit = true
}

build.gradle wear app level

apply plugin: 'com.github.triplet.play'

...

play {
    track = "wear:internal"
    serviceAccountCredentials = file(GOOGLE_ACCOUNT_SERVICE_FILE)
    // Commit this build separately from the mobile build.
    commit = true
}

However, I'm receiving the following error:

Screenshot 2023-08-09 at 2 15 29 PM

What am I missing?

damiafuentes commented 1 year ago

Which version are you using?

crysxd commented 1 year ago

3.7.0

damiafuentes commented 1 year ago

Found it, had to remove the commit = true line. Thank you!

positive-infinity commented 1 year ago

I am also facing this issue and I am still getting the "Cannot convert URL 'wear:production.txt' to a file." error, no matter if I remove commit property entirely or set it to true or false. @damiafuentes: Did you change anything else?, @crysxd: Which OS are you on? Maybe this is a Linux / Windows issue? I am on Windows.

positive-infinity commented 1 year ago

I think the problem is that GPP tries to generate and/or read from files which are named by the track name (e.g. File(locale, "$track.txt")). In case of track names with prefix (i.e. wear:production) this name contains the char ":" which is invalid for file names (at least on Windows). This is why it works if you set the release name explicitely by usage of releaseName.set("XXX") and only use default release notes. In this case, the track name file are not needed (not read at all or a fallback in case of failure exists).

avalanchas commented 1 year ago

Thanks @positive-infinity, can confirm, this is the minimal working example as of version 3.8.4 of this plugin:

play {
    track.set("wear:$yourTrackName")
    releaseName.set("$yourVersionName")
}
play {
    track.set("automotive:$yourTrackName")
    releaseName.set("$yourVersionName")
}
eytanbiala commented 6 months ago

Hello, we are hitting this as well with automotive. It seems like the fix from @chimbori should work - is it possible to merge it upstream?

eytanbiala commented 3 months ago

@SUPERCILEX could you review a PR for this?

SUPERCILEX commented 3 months ago

Sure

SUPERCILEX commented 3 months ago

The fix should be available in snapshot builds.

eytanbiala commented 3 months ago

Thanks so much!! Any idea when the next release will be?

SUPERCILEX commented 3 months ago

Can someone check that snapshot builds work as expected?

chimbori commented 1 month ago

I fiddled around with Gradle, Version Catalogs, plugin IDs, Sonatype identifiers, etc. for far too long, but was not able to get my projects to use the Snapshot version. Any chance you would consider simply publishing this to a regular release, and I could test/verify afterwards?

(To be clear, this failure is simply in getting Gradle to play well with Sonatype Snapshots repo, I wasn’t even able to test this plugin to see if it works or not.)

SUPERCILEX commented 1 month ago

Alright, I decided to say screw it and pray that we didn't break anything. I just triggered a release so it would be helpful if you could dogfood v3.11 before people notice it's out.

chimbori commented 1 month ago

Just tested; nothing broke, but Wear publishing wasn't fixed either. 😔

I'm going to try to see if I can run a local copy of the plugin, but it's late tonight, so likely tomorrow.

Thanks for the quick push, I'll update this thread.

chimbori commented 1 month ago

Made progress, but not resolved yet.

  1. Turns out that a part of the problem was that the Bootstrap task had previously downloaded (successfully) files named wear:alpha.txt etc. to my local repo, and I had committed them to Git as well. Deleting them got rid of the original error I was seeing, so my PR has at least made a difference there. Needs another PR to have the Bootstrap task rename files to filename-safe characters when downloading.

  2. But now, Play is not able to find the right track, so I’m looking at that.

Execution failed for task ':xxx:publishReleaseBundle'.
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishBundle$Processor
   > 404 Not Found
     PUT https://androidpublisher.googleapis.com/androidpublisher/v3/applications/xxx/edits/yyy/tracks/wear:alpha
     {
       "code": 404,
       "errors": [
         {
           "domain": "global",
           "message": "Track not found: wear:alpha.",
           "reason": "notFound"
         }
       ],
       "message": "Track not found: wear:alpha.",
       "status": "NOT_FOUND"
     }
SUPERCILEX commented 1 month ago

Interesting, thanks for sharing. Maybe there's a different way to publish colon tracks?

chimbori commented 1 month ago

Using track name alpha instead of wear:alpha leads to a 400 too:

> 400 Bad Request
     POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/xxx/edits/yyy:commit?changesNotSentForReview=false
     {
       "code": 400,
       "errors": [
         {
           "domain": "global",
           "message": "The APK or bundle with version code 20002 requires the Wear OS system feature android.hardware.type.watch. To publish this release on the current track, remove this artifact.",
           "reason": "badRequest"
         }
       ],
       "message": "The APK or bundle with version code 20002 requires the Wear OS system feature android.hardware.type.watch. To publish this release on the current track, remove this artifact.",
       "status": "INVALID_ARGUMENT"
     }

This used to be so straightforward. Google messed it up badly. :(