我正处于开发支持AWS的移动应用程序的初期阶段(非常新手级别的android开发人员-适用于高级项目)。我正在使用一个名为RecoveryAsAService的定制生成的SDK。我设置了清单权限,但是当我到达factory.build()时,将引发以下异常:
Method threw 'com.amazonaws.mobileconnectors.apigateway.ApiClientException' exception. Cannot evaluate $Proxy1.toString()
在线:
final RecoveryAsAServiceClient client = factory.build(RecoveryAsAServiceClient.class);
从该网站以及AWS及其论坛的所有文档中,我无法根源导致我的特殊情况出错。有人知道导致此错误的原因吗?建立连接吗?或访问我的AWS服务器?任何见解都会有所帮助。
我所有的许可:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
依赖项:
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'app/libs')
使用.jar文件:
aws-android-sdk-apigateway-core-2.7.2.jar
aws-android-sdk-core-2.7.2.jar
aws-apigateway-api-sdk-2.0.0.jar
我的活动代码:
AWSCredentialsProvider credenetialsProvider = new CognitoCachingCredentialsProvider(
getApplicationContext(), // activity context
"COGNITO IDENTITY POOL ID", // Cognito identity pool id
Regions.US_WEST_2 // region of Cognito identity pool
);
ApiClientFactory factory = new ApiClientFactory();
{
factory.region("US_WEST_2");
factory.credentialsProvider(credenetialsProvider);
factory.endpoint("ENDPOINT");
}
try {
final RecoveryAsAServiceClient client = factory.build(RecoveryAsAServiceClient.class);
} catch (Exception e) {
landingPageTextView.setText("PROXY ERROR");
Log.i(e.toString()));
}