awslabs / aws-mobile-appsync-sdk-android

Android SDK for AWS AppSync.
https://docs.amplify.aws/sdk/api/graphql/q/platform/android/
Apache License 2.0
105 stars 58 forks source link

Is there a recommended proguard configuration? #24

Closed dy08 closed 6 years ago

dy08 commented 6 years ago

To help us solve your problem better, please answer the following list of questions.

In what version of SDK are you facing the problem? Can you try the latest version?

2.6.22

Is the issue limited to Simulators or Physical Devices?

Both

Is this problem related to a specific API level or Brand?

No

Can you give us steps to reproduce with a minimal, complete, and verifiable example?

Please include any specific network conditions that might be required to reproduce the problem.

I tried to run my application using proguard configuration given in https://github.com/aws/aws-sdk-android/blob/master/Proguard.md. But I got some errors which I've put in the stacktrace.

Is there a recommended proguard file I can reference when integrating AppSync?

If my code snippet looks suspicious, please let me know.

Thanks in advance

proguard.pro

# Class names are needed in reflection
-keepnames class com.amazonaws.**
-keepnames class com.amazon.**
# Request handlers defined in request.handlers
-keep class com.amazonaws.services.**.*Handler
# The following are referenced but aren't required to run
-dontwarn com.fasterxml.jackson.**
-dontwarn org.apache.commons.logging.**
# Android 6.0 release removes support for the Apache HTTP client
-dontwarn org.apache.http.**
# The SDK has several references of Apache HTTP client
-dontwarn com.amazonaws.http.**
-dontwarn com.amazonaws.metrics.**

build.gradle

android {

   buildType {
      ...
      release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
   }

   dependencies {
       implementation "com.amazonaws:aws-android-sdk-appsync:2.6.22"
       implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0"
       implementation "org.eclipse.paho:org.eclipse.paho.android.service:1.1.1"
       ...
   }
}

Please include a stacktrace if applicable.

Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find superclass or interface com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.AuthenticationHandler
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.PutObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.PutObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.ObjectMetadata
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.ObjectMetadata
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.ObjectMetadata
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.PutObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.PutObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.AmazonS3Client
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.AmazonS3Client
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.GetObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.GetObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.AmazonS3Client
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.AmazonS3Client
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.AmazonS3Client
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.AmazonS3Client
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.PutObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.ObjectMetadata
Warning: com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation: can't find referenced class com.amazonaws.services.s3.model.GetObjectRequest
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.handlers.AuthenticationHandler
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserSession
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserSession
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.tokens.CognitoAccessToken
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.tokens.CognitoAccessToken
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserSession
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoDevice
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserSession
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoDevice
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.MultiFactorAuthenticationContinuation
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.MultiFactorAuthenticationContinuation
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.ChallengeContinuation
Warning: com.amazonaws.mobileconnectors.appsync.sigv4.BasicCognitoUserPoolsAuthProvider$1: can't find referenced class com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.ChallengeContinuation
minbi commented 6 years ago

The warnings you listed can all safely be ignored IF you are not using those features.

Warnings for S3ObjectManagerImplementation require the S3 library if you are using complex objects. Warnings for BasicCognitoUserPoolsAuthProvider require the CognitoIdentityProvider library if you are using Cognito UserPools as your authentication mechanism.

mutablealligator commented 6 years ago

@dy08 Closing this issue. If there are further questions, please feel free to reopen the issue.

zeroDivider commented 4 years ago

Is this really good idea closing this issue? I may not use these libraries, but I see a lot of warnings on my build which does not look good at all