3

我正在使用示例 AWS Android SDK 应用程序 UserPreferenceDemo 中的一些代码。我让示例应用程序正常工作,以便它能够创建一个新的 DynamoDB 表。但是,当我尝试在我的应用程序中实现相同的代码时,我在 AmazonClientManager 类中收到日志消息“凭据已过期”并且我的应用程序崩溃了。

这是我用来创建表的代码。

final Button submit = (Button) findViewById(R.id.bSubmitComplete)
submit.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        Log.i(TAG, "submitBttn clicked.");

        new DynamoDBManagerTask()
        .execute(DynamoDBManagerType.CREATE_TABLE);
    }
});

这是记录消息的代码。

public Response validateCredentials() {

    Response ableToGetToken = Response.SUCCESSFUL;

    if (AmazonSharedPreferencesWrapper
            .areCredentialsExpired(this.sharedPreferences)) {

        synchronized (this) {

            if (AmazonSharedPreferencesWrapper
                    .areCredentialsExpired(this.sharedPreferences)) {

                Log.i(LOG_TAG, "Credentials were expired.");

                AmazonTVMClient tvm = new AmazonTVMClient( this.sharedPreferences, PropertyLoader.getInstance().getTokenVendingMachineURL(), PropertyLoader.getInstance().useSSL() );

                ableToGetToken = tvm.anonymousRegister();

                if (ableToGetToken.requestWasSuccessful()) {

                    ableToGetToken = tvm.getToken();

                    if (ableToGetToken.requestWasSuccessful()) {
                        Log.i(LOG_TAG, "Creating New Credentials.");
                        initClients();
                    }
                }
            }
        }

    } else if (ddb == null) {

        synchronized (this) {

            if (ddb == null) {

                Log.i(LOG_TAG, "Creating New Credentials.");
                initClients();
            }
        }
    }

    return ableToGetToken;
}
4

1 回答 1

4

简单的解决方法,愚蠢的问题,但我一直在努力解决这个问题。

卸载并重新安装该应用程序。现在它可以工作了

于 2013-06-28T01:42:08.280 回答