cianru / huawei-appgallery-publish-gradle-plugin

Huawei AppGallery Publish Gradle Plugin allows you to publish the android release build file (*.apk or *.aab) to the Huawei AppGallery store
Apache License 2.0
113 stars 20 forks source link

AGP compatibility #16

Closed CedrickFlocon closed 3 years ago

CedrickFlocon commented 3 years ago

Huawei-pubilsh-gradle-plugin version 1.2.1 is not compatible with com.android.tools.build:gradle:4.1.1

Log :

* What went wrong:
Execution failed for task ':app:publishHuaweiAppGalleryProdHmsRelease'.
> com.android.build.gradle.internal.scope.InternalArtifactType$BUNDLE cannot be cast to com.android.build.api.artifact.ArtifactType

Gradle Play publisher already has the issue and fixed it : https://github.com/Triple-T/gradle-play-publisher/issues/824 I guess this is the related commit : https://github.com/Triple-T/gradle-play-publisher/commit/4d52010bfdde024d3e8a2bb16dd26bb42cecea07 https://github.com/Triple-T/gradle-play-publisher/commit/354812b6d789abee4d2c22c598424f73962b54c5

ipBill commented 3 years ago

Same you It's not working. type aab

cosic commented 3 years ago

@CedrickFlocon @ipBill Hi! Yeap, it doesn't work yet. Thx for created issue. To continue using the plugin you can temporary apply buildFile plugin parameter. For example

buildFile = "$projectDir/build/outputs/bundle/release/sample1-release.aab"
juliocbcotta commented 3 years ago

I also have this issue, but my apk name is generated dynamically so I can't just put it in the gradle file.

cosic commented 3 years ago

@BugsBunnyBR Hi! To dynamically detect the build file on unix system you can use cli parameter --buildFile before fixing this issue. Something like that

./gradlew publishHuaweiAppGalleryRelease \                                                                                                                               ✔     
    --buildFile=$(ls ./app/build/outputs/apk/release/*.apk| head -1) \
    --buildFormat=apk

I understand that this is not very convenient, but this will temporarily solve your problem before fixing the bug to dynamically detect the build file you can use something like that

juliocbcotta commented 3 years ago

@cosic , could you take a look at the PR?

juliocbcotta commented 3 years ago

Can we have a release or at least a SNAPSHOT version to test now that the PR was merged?

cosic commented 3 years ago

@BugsBunnyBR Yeap, you can check your changes at 1.2.2-SNAPSHOT version

juliocbcotta commented 3 years ago

I tested the snapshot in AGP 4.1.1 and it worked.

it would be great to have an option dry-run that does everything that needs to do but abort the upload right before it starts sending data... so we could test the AGP integration more easily.

cosic commented 3 years ago

@BugsBunnyBR My dream is to write tests to test this. But you can execute plugin for sample1 project. It'll find build file and return error for Rest API request.