title: Creating AmazonDynamoDBClient with AWSCredentials
body: <p>We are developing a basic game for android phones and have recently switched from Eclipse IDE to Android Studios. With the switch, I was forced to move from <strong>aws-java-sdk-1.9.30</strong> to <strong>aws-android-sdk-2.2.0</strong>.</p>
  
  <p>I have attempted to update the AWS code and it is now compiling, however I have come across an issue while creating the <code>AmazonDynamoDBClient</code>.</p>
  
  <p>I am getting this runtime error: </p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: no HostnameVerifier specified
  </code></pre>
  
  <p>I'm not sure if I am missing a step somewhere. If anyone can help shed some light on what may be causing the issue, I will be very thankful!</p>
  
  <p>On a related note, most of the examples I have been able to find, and the examples on which I based my initial code, seem to be for the <strong>aws-java-sdk-1.9.30</strong> jars. If anyone knows of where I can find examples that are suited for the <strong>aws-android-sdk-2.2.0</strong> jars, it would help immensely!</p>
  
  <p>Here is the entire stack trace as requested:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>CLIENT:com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient@5ef04b5
  Creating Match Details...
  Exception in thread "main" java.lang.IllegalArgumentException: no     HostnameVerifier specified
  at     javax.net.ssl.HttpsURLConnection.setHostnameVerifier(HttpsURLConnection.java:265)
  at     com.amazonaws.http.UrlHttpClient.configureConnection(UrlHttpClient.java:169)
  at com.amazonaws.http.UrlHttpClient.createConnection(UrlHttpClient.java:105)
  at com.amazonaws.http.UrlHttpClient.execute(UrlHttpClient.java:60)
  at     com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:361)
  at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:211)
  at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:2930)
  at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.query(AmazonDynamoDBClient.java:1240)
  at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.query(DynamoDBMapper.java:2181)
  at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.query(DynamoDBMapper.java:2137)
  at com.towerfield.aws.MatchDetails.getMatchIds(MatchDetails.java:201)
  at com.towerfield.aws.MatchDetails.&lt;init&gt;(MatchDetails.java:109)
  at com.towerfield.aws.MatchDetails.main(MatchDetails.java:84)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  
  Process finished with exit code 1
  </code></pre>
  
  <p>Here is where the exception is thrown (inside HTTPSURLConnection.java):</p>
  
  <pre class="lang-java prettyprint-override"><code>public void setHostnameVerifier(HostnameVerifier v) 
  {
      if (v == null) 
      {
          throw new IllegalArgumentException("HostnameVerifier is null");
      }
      hostnameVerifier = v;
  }
  </code></pre>
  
  <p>Here is the relevant code which seems to be causing the runtime error:</p>
  
  <pre class="lang-java prettyprint-override"><code>static AmazonDynamoDBClient client;
  ...
  BasicAWSCredentials credentials = new BasicAWSCredentials("KEY","SECRETKEY");
  client = new AmazonDynamoDBClient(credentials);
  ...
  DynamoDBMapper mapper = new DynamoDBMapper(client);
  ...
  List&lt;PlayersListOfActiveMatches&gt; latestReplies = mapper.query(PlayersListOfActiveMatches.class, queryExpression);
  </code></pre>
  
  <hr>
  
  <p>Here is a list of my imports as was requested:</p>
  
  <pre class="lang-java prettyprint-override"><code>import com.amazonaws.AmazonServiceException;
  import com.amazonaws.auth.BasicAWSCredentials;
  import   com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBAttribute;
  import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBHashKey;
  import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper;
  import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBQueryExpression;
  import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBRangeKey;
  import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBTable;
  import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
  import com.amazonaws.services.dynamodbv2.model.AttributeValue;
  import com.amazonaws.services.dynamodbv2.model.Condition;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  </code></pre>