Skip to content

Proguard/R8 build issue #2998

@4brunu

Description

@4brunu

Before opening, please confirm:

Language and Async Model

Kotlin - Coroutines, Kotlin

Amplify Categories

Authentication

Gradle script dependencies

implementation("com.amplifyframework:aws-auth-cognito:2.27.1")
implementation("com.amplifyframework:core-kotlin:2.27.1")

Environment information

------------------------------------------------------------
Gradle 8.13
------------------------------------------------------------

Build time:    2025-02-25 09:22:14 UTC
Revision:      073314332697ba45c16c0a0ce1891fa6794179ff

Kotlin:        2.0.21
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  21.0.6 (Azul Systems, Inc. 21.0.6+7-LTS)
Daemon JVM:    /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home (no JDK specified, using current Java home)
OS:            Mac OS X 15.3.1 aarch64

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

I was in version 2.25.1 but when I upgraded to version 2.26.0 or 2.27.1 I got the following build error related to pro guard/R8.

Task ':projectandroid:minifyProjectAdhocWithR8' is not up-to-date because:
  No history is available.
R8 is a new Android code shrinker. If you experience any issues, please file a bug at
https://issuetracker.google.com, using 'Shrinker (R8)' as component name.
Current version is: 8.8.34.

file or directory '/Users/User/Developer/ProjectAndroid/projectandroid/build/intermediates/generated_proguard_file/projectAdhoc/mergeProjectAdhocGeneratedProguardFiles/proguard.txt', not found
WARNING: R8: The class androidx.navigation.NavType is present but not the method androidx.navigation.NavType androidx.navigation.NavType$Companion.fromArgType(java.lang.String, java.lang.String) which suggests some unsupported set-up where androidx is pre-shrunk without keeping the method androidx.navigation.NavType androidx.navigation.NavType$Companion.fromArgType(java.lang.String, java.lang.String).
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/User/Developer/ProjectAndroid/projectandroid/build/outputs/mapping/projectAdhoc/missing_rules.txt.
ERROR: R8: Missing class aws.smithy.kotlin.runtime.http.engine.okhttp4.OkHttp4Engine (referenced from: void com.amplifyframework.util.AmplifyHttpKt.setHttpEngine(aws.smithy.kotlin.runtime.http.config.HttpClientConfig$Builder))

> Task :projectandroid:minifyProjectAdhocWithR8 FAILED

and the content of the file missing_rules.txt

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn aws.smithy.kotlin.runtime.http.engine.okhttp4.OkHttp4Engine

Reproduction steps (if applicable)

Import those two dependencies to a project and perform a build with proguard/R8

implementation("com.amplifyframework:aws-auth-cognito:2.27.1")
implementation("com.amplifyframework:core-kotlin:2.27.1")

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreAmplify Core library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions