0

我在我的应用程序中实现了AWS Lex Bot,所需的文件(如amplifyconfiguration.json 和 awsconfiguration.json)放在res- >raw 目录中。我的应用程序在使用调试模式或使用 shrinkresource=false时运行良好。但是当我通过在gradle中添加shrinkResources = true来使用代码混淆时

    AWSMobileClient.getInstance().initialize(context, new Callback<UserStateDetails>() {
            @Override
            public void onResult(UserStateDetails result) {
            //some code here
            }

            @Override
            public void onError(Exception e) {
                **Here it gives error - Failed to initialize Cognito identity, Please check your awsconfiguration.json**
            }
        });

我的awsconfiguration如下所示:

{
"UserAgent": "aws-amplify-cli/0.1.0",
"Version": "0.1.0",
"IdentityManager": {
    "Default": {}
},
"CredentialsProvider": {
    "CognitoIdentity": {
        "Default": {
            "PoolId": "ap-southeast-1:xxxxxxxxxxxx-xxxxxxxxx-xxxxxxx-xxxxxxxxx",
            "Region": "ap-southeast-1"
        }
    }
},
"CognitoUserPool": {
    "Default": {
        "PoolId": "ap-southeast-1_2oS3tgTPt",
        "AppClientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "Region": "ap-southeast-1"
    }
},
"Auth": {
    "Default": {
        "authenticationFlowType": "USER_SRP_AUTH"
    }
},
"Lex": {
    "xxxxx_cloudFormation_staging": {
        "Name": "xxxxxx_cloudFormation_staging",
        "Alias": "$LATEST",
        "Region": "ap-southeast-1"
    }
}
}

我目前没有在 proguard 中添加任何规则,因为我不知道有关AWS的任何规则,因为我是新手。请提出一些解决方案。

谢谢

4

0 回答 0