aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
232 stars 108 forks source link

[Authenticator] The library should declare the needed consumer proguard rules #2797

Closed pmellaaho closed 1 week ago

pmellaaho commented 1 month ago

Before creating a new issue, please confirm:

Which UI component?

Authenticator

Gradle script dependencies

// Put output below this line
authenticatorVersion = "1.1.0"

Environment information

# Put output below this line
Gradle 8.5

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

When I'm doing a release build of my App that uses Amplify UI I get the following:

> Task :app:minifyReleaseWithR8 AGPBI: {"kind":"warning","text":"Missing class kotlinx.parcelize.Parcelize (referenced from: com.amplifyframework.notifications.pushnotifications.NotificationContentProvider$FCM and 2 other contexts)","sources":[{}],"tool":"R8"}

I can get around this by including the following in my proguardrules.pro -dontwarn kotlinx.parcelize.Parcelize*

But the needed rules should really come with the library

Reproduction steps (if applicable)

No response

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line
AGPBI: {"kind":"warning","text":"Missing class kotlinx.parcelize.Parcelize (referenced from: com.amplifyframework.notifications.pushnotifications.NotificationContentProvider$FCM and 2 other contexts)","sources":[{}],"tool":"R8"}

amplifyconfiguration.json

No response

Additional information and screenshots

No response

mattcreaser commented 1 month ago

This appears to be coming from the underlying Amplify library, not from Authenticator. Authenticator does not use push notifications. Transferring the issue there.

vincetran commented 1 week ago

Hi @pmellaaho, I've looked at this report and have been unable to reproduce this issue. In my sample app, I have the following Amplify dependencies:

    val amplify = "2.17.0"
    implementation("com.amplifyframework:core:$amplify")
    implementation("com.amplifyframework:aws-api:$amplify")
    implementation("com.amplifyframework:aws-datastore:$amplify")
    implementation("com.amplifyframework:aws-auth-cognito:$amplify")
    implementation("com.amplifyframework:aws-push-notifications-pinpoint:$amplify")

I have minify enabled and have the default empty proguard rules:

debug {
    isMinifyEnabled = true
    proguardFiles(
        getDefaultProguardFile("proguard-android-optimize.txt"),
        "proguard-rules.pro"
    )
}

Yet I'm able to build and minify without issue. Can you provide any more details that would suggest the library is at fault?

pmellaaho commented 1 week ago

Hello, thanks for looking into this. I have the following dependencies:

authenticator = { module = "com.amplifyframework.ui:authenticator", version.ref = "authenticatorVersion" } aws-auth-cognito = { module = "com.amplifyframework:aws-auth-cognito", version.ref = "awsAuthCognitoVersion" } core-kotlin = { module = "com.amplifyframework:core-kotlin", version.ref = "coreKotlinVersion" }

I'm not sure which changes in my code has made the build warning to go away but I'm not seeing it anymore either. I have to return to this subject if the problem appears later again.

vincetran commented 1 week ago

Gotcha, thanks for following up then! I'll close this issue and if the problem comes up again, please let us know.

github-actions[bot] commented 1 week ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.