Android 连接异常
当我尝试启动 url 连接时,收到一条奇怪的错误消息。 这是日志输出:
E/admarvelservice( 2366): postString: &site_id=14488&partner_id=ef8a30b841b36346& timeout=5000&version=1.5&language=java&format=android&sdk_version=2.1.3&sdk_version_date=2011-08-08&device_model=Nexus+S&device_name=GRJ22&get_cached_ads=true&device_systemversion=2.3.5&resolution_width=480&max_image_width=480&resolution_height=800&max_image_height=800&device_os=Android&target_params=appv%3D%3ES%7C%7Cla%3D%3Ede%7C%7Cco%3D%3EAT%7C%7Cscreenorient%3D%3Ep%7C%7Cappvn%3D%3E3.4.0%252F%7C%7Cosv%3D%3E2.3.5
D/admarvelservice( 2366): Error: java.net.ConnectException: ads.admarvel.com/127.0.0.1:80 - Connection refused
有人知道这里有什么问题吗? 谢谢。
编辑:我如何连接:
URL myURL;
try {
myURL = new URL(_url);
m_ucon = myURL.openConnection();
m_ucon.setConnectTimeout(8000);
} catch (Exception e) {
e.printStackTrace();
}
有趣的是,连接正在工作,但每秒我的 logcat 都会喊出上面显示的错误消息。
i get a strange error message when i try to start an url connection.
here´s the log output:
E/admarvelservice( 2366): postString: &site_id=14488&partner_id=ef8a30b841b36346& timeout=5000&version=1.5&language=java&format=android&sdk_version=2.1.3&sdk_version_date=2011-08-08&device_model=Nexus+S&device_name=GRJ22&get_cached_ads=true&device_systemversion=2.3.5&resolution_width=480&max_image_width=480&resolution_height=800&max_image_height=800&device_os=Android&target_params=appv%3D%3ES%7C%7Cla%3D%3Ede%7C%7Cco%3D%3EAT%7C%7Cscreenorient%3D%3Ep%7C%7Cappvn%3D%3E3.4.0%252F%7C%7Cosv%3D%3E2.3.5
D/admarvelservice( 2366): Error: java.net.ConnectException: ads.admarvel.com/127.0.0.1:80 - Connection refused
anybody an idea whats the problem here?
thanks.
EDIT: how i connect:
URL myURL;
try {
myURL = new URL(_url);
m_ucon = myURL.openConnection();
m_ucon.setConnectTimeout(8000);
} catch (Exception e) {
e.printStackTrace();
}
funny thing is that the connection is working, but every second my logcat shouts the errormessage shown above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我认为这与你的申请无关。
广告服务 (admarvelservice) 是一个例外。
I think this has nothing to do with your application.
The exception comes from an Advertising Service (admarvelservice).
您正在使用广告拦截器应用程序并且安装了 Shazam。只需获取 Shazam 的付费版本、删除广告拦截器或忽略该错误即可。
You are using an adblocker app and you have Shazam installed. Just either get the paid version of Shazam, remove ad blocker or just ignore the error.
首先在 AndroidManifest.xml 中检查这一点:
本地主机 IP 地址是:
127.0.0.1
,因此您也可以通过此检查。尝试使用此 http 连接:
您应该尝试
Singleton 模式
进行请求响应。Check this first in your AndroidManifest.xml:
Localhost ip address is:
127.0.0.1
so u can check by this too.try with this http connection:
you should try
Singleton pattern
for request response.您必须在 AndroidManifest.xml 中设置使用权限
You must set uses permission in the AndroidManifest.xml
以我的经验来说
的原因是:
a|- 您无权访问,因为您可能位于代理下,并且需要凭据才能建立连接。
b|- 您需要在
AndroidManifest.xml
中添加连接权限:For my experience
is caused by :
a|- You don´t have access because probably you are under a Proxy and you need credentials to establish a connection.
b|- You need to add the persmission for connection inside your
AndroidManifest.xml
: