无法使用Android上的AWS Mobile Analytics解决主机错误

时间:2015-02-27 16:51:40

标签: android amazon-web-services host amazon-mobile-analytics

我正在尝试实施从http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/analytics.html

获得的AWS Mobile Analytics的入门代码

我在清单中设置了所有设置以及Internet权限,但在所有调试和故障排除后我仍然收到此错误。

02-27 17:40:38.403  25639-25830/com.bluecolony.watchappstore I/AmazonHttpClient﹕ Unable to execute HTTP request: Unable to resolve host "mobileanalytics.us-east-1.": No address associated with hostname
java.net.UnknownHostException: Unable to resolve host "mobileanalytics.us-east-1.": No address associated with hostname
        at java.net.InetAddress.lookupHostByName(InetAddress.java:424)
        at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
        at java.net.InetAddress.getAllByName(InetAddress.java:214)
        at com.amazonaws.org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
        at com.amazonaws.org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
        at com.amazonaws.org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
        at com.amazonaws.org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645)
        at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
        at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:400)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:243)
        at com.amazonaws.services.mobileanalytics.AmazonMobileAnalyticsClient.invoke(AmazonMobileAnalyticsClient.java:313)
        at com.amazonaws.services.mobileanalytics.AmazonMobileAnalyticsClient.putEvents(AmazonMobileAnalyticsClient.java:258)
        at com.amazonaws.mobileconnectors.amazonmobileanalytics.internal.delivery.DefaultDeliveryClient.submitEvents(Unknown Source)
        at com.amazonaws.mobileconnectors.amazonmobileanalytics.internal.delivery.DefaultDeliveryClient.access$600(Unknown Source)
        at com.amazonaws.mobileconnectors.amazonmobileanalytics.internal.delivery.DefaultDeliveryClient$3.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:841)
 Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
        at libcore.io.Posix.getaddrinfo(Native Method)
        at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61)
        at java.net.InetAddress.lookupHostByName(InetAddress.java:405)

com.amazonaws.org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
        at com.amazonaws.org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
        at com.amazonaws.org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
        at com.amazonaws.org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
        at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645)
        at com.amazonaws.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
        at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
        at com.amazonaws.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:400)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:243)
        at com.amazonaws.services.mobileanalytics.AmazonMobileAnalyticsClient.invoke(AmazonMobileAnalyticsClient.java:313)
        at com.amazonaws.services.mobileanalytics.AmazonMobileAnalyticsClient.putEvents(AmazonMobileAnalyticsClient.java:258)
        at com.amazonaws.mobileconnectors.amazonmobileanalytics.internal.delivery.DefaultDeliveryClient.submitEvents(Unknown Source)
        at com.amazonaws.mobileconnectors.amazonmobileanalytics.internal.delivery.DefaultDeliveryClient.access$600(Unknown Source)
        at com.amazonaws.mobileconnectors.amazonmobileanalytics.internal.delivery.DefaultDeliveryClient$3.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:841)

我尝试过使用ConnectivityManager和InetAddress.getByName(“google.com”)。isReachable(3)来确认我的代码能够访问互联网。

到目前为止,我的假设是以某种方式调用的主机名是错误的。它应该是“mobileanalytics.us-east-1.amazonaws.com”而不是“mobileanalytics.us-east-1”。 。否则可能是防火墙问题或https,我必须进一步探讨。我在移动设备上使用wifi连接。

有任何帮助指针吗?

1 个答案:

答案 0 :(得分:1)

看起来这是AWS Mobile SDK v2.1.9的已知错误。

阅读@ Yangfan的评论看起来已经在2.1.10版中解决了

http://aws.amazon.com/releasenotes/3841134019807789