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

publishProducts not working #772

Closed eneasgesing closed 4 years ago

eneasgesing commented 4 years ago

Describe the bug

I use this plugin to publish 120+ apps and everithing works well when I update my existing apps. I've been used it only for AppBundle update, and works great.

Now I want to automate the in app subsriptions, but is not working. I downloaded a sample structure via gradlew bootstrap and I'm using it, but nothing is filled on Play Console when I run gradlew publishProducts.

No error is displayed and script took only 1s to execute:

BUILD SUCCESSFUL in 1s

How To Reproduce

I run the following batch script on project root:

File: generatePlay.cmd

@echo off

powershell -Command "(gc play_default\premium_ano.json) -replace 'NOME_PACOTE', '%1' | Out-File -encoding ASCII mobile\src\main\play\products\premium_ano.json"
powershell -Command "(gc play_default\premium_mes.json) -replace 'NOME_PACOTE', '%1' | Out-File -encoding ASCII mobile\src\main\play\products\premium_mes.json"
powershell -Command "(gc play_default\premium_user.json) -replace 'NOME_PACOTE', '%1' | Out-File -encoding ASCII mobile\src\main\play\products\premium_user.json"

echo %1
rmdir build /s /q
rmdir mobile\build /s /q
gradlew clean -Pappid=%1
gradlew cleanBuildCache -Pappid=%1
gradlew publishProducts -Pappid=%1

The first three powershell cmd are for generate the products with correct packageName. They are working good and the files generated in the correct folder (the files are .json extension, I just renamed it to .txt to upload):

premium_mes.txt premium_user.txt premium_ano.txt

I use rmdir to remove build dirs because this solved a old bug that generates the wrong app on batch. I run clean and cleanBuildCache for same reason.

For last, I run publishProducts.

To run the script I call it like "generatePlay.cmd my.app.id"

The appid parameter to gradle script is ok, because is the same I use to generate App Bundles.

Versions

Tasks executed

Already described.

Expected behavior

App products published on Play Console.

Additional context (if a crash, provide stack trace)

No error.

SUPERCILEX commented 4 years ago

Can you share the build log please?

eneasgesing commented 4 years ago

It may seem like a silly question, but are the logs stored in a file? I tried to search but didn't find it.

Anyway, these are the logs generated on the screen:

Capturar

SUPERCILEX commented 4 years ago

The Gradle logs? No, those aren't stored anywhere by default, but we can pipe them to a file. Can you update your script to run gradlew publishProducts --console=plain --info -Pappid=%1 > logs.txt and upload the logs.txt file?

eneasgesing commented 4 years ago

Ok, I did it, but can't find any logs.txt. Is expected to logs.txt to be generated in same directory?

SUPERCILEX commented 4 years ago

It should be in the directory you ran the command.

eneasgesing commented 4 years ago

After some tests, I think the problem is in the batch file. Is not a plugin bug.

When I directly run the following command on CMD, it works (products added and log generated):

gradlew publishProducts -Pappid=com.eneasgesing.radios.catbrfutebol > logs.txt

But the same command in batch file not works. Do you know what can be wrong?

eneasgesing commented 4 years ago

I removed the following lines from batch file and works fine now. I don't know why, but is working.

rmdir build /s /q
rmdir mobile\build /s /q
gradlew clean -Pappid=%1
gradlew cleanBuildCache -Pappid=%1

This is sufficient for me, thank you for your help.

SUPERCILEX commented 4 years ago

Lol, glad it works. 👍