添加 Scringo 库后的 Android 错误



在我的项目中包括Scringo库之后,实现快速入门说明:

private Scringo scringo;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Scringo.setAppId("<MY_SCRINGO_APP_ID>");
    scringo = new Scringo(this);
    scringo.init();
    scringo.addSidebar();

}
@Override
protected void onStart() {
    super.onStart();
    scringo.onStart();
}
@Override
protected void onStop() {
    super.onStop();
    scringo.onStop();
}

我合并清单.xml以获取权限,并设置新按钮以打开Scringo菜单。运行应用程序后,单击按钮打开Scringo菜单时,出现错误:

    12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271)
12-21 18:59:31.275: E/Scringo(5573):    at com.scringo.utils.ScringoHttpFetcher.getResponseStr(ScringoHttpFetcher.java:132)
12-21 18:59:31.275: E/Scringo(5573):    at com.scringo.utils.ScringoJsonFetcher.handleResponse(ScringoJsonFetcher.java:59)
12-21 18:59:31.275: E/Scringo(5573):    at com.scringo.utils.ScringoJsonFetcher.run(ScringoJsonFetcher.java:40)
12-21 18:59:31.275: E/Scringo(5573): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.io.Posix.getaddrinfo(Native Method)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
12-21 18:59:31.275: E/Scringo(5573):    at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
12-21 18:59:31.275: E/Scringo(5573):    ... 18 more
12-21 18:59:31.275: E/Scringo(5573): Caused by: libcore.io.ErrnoException: getaddrinfo failed: EACCES (Permission denied)
12-21 18:59:31.275: E/Scringo(5573):    ... 21 more
12-21 18:59:31.275: E/Scringo(5573): Error fetching
12-21 18:59:31.275: E/Scringo(5573): java.lang.SecurityException: Permission denied (missing INTERNET permission?)
12-21 18:59:31.275: E/Scringo(5573):    at java.net.InetAddress.lookupHostByName(InetAddress.java:418)
12-21 18:59:31.275: E/Scringo(5573):    at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
12-21 18:59:31.275: E/Scringo(5573):    at java.net.InetAddress.getAllByName(InetAddress.java:214)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:461)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271)
12-21 18:59:31.275: E/Scringo(5573):    at com.scringo.utils.ScringoHttpFetcher.getResponseStr(ScringoHttpFetcher.java:132)
12-21 18:59:31.275: E/Scringo(5573):    at com.scringo.utils.ScringoJsonFetcher.handleResponse(ScringoJsonFetcher.java:59)
12-21 18:59:31.275: E/Scringo(5573):    at com.scringo.utils.ScringoJsonFetcher.run(ScringoJsonFetcher.java:40)
12-21 18:59:31.275: E/Scringo(5573): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.io.Posix.getaddrinfo(Native Method)
12-21 18:59:31.275: E/Scringo(5573):    at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
12-21 18:59:31.275: E/Scringo(5573):    at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
12-21 18:59:31.275: E/Scringo(5573):    ... 18 more
12-21 18:59:31.275: E/Scringo(5573): Caused by: libcore.io.ErrnoException: getaddrinfo failed: EACCES (Permission denied)
12-21 18:59:31.275: E/Scringo(5573):    ... 21 more
12-21 18:59:34.305: E/Scringo(5573): Error fetching
12-21 18:59:34.305: E/Scringo(5573): java.lang.SecurityException: Permission denied (missing INTERNET permission?)
12-21 18:59:34.305: E/Scringo(5573):    at java.net.InetAddress.lookupHostByName(InetAddress.java:418)
12-21 18:59:34.305: E/Scringo(5573):    at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
12-21 18:59:34.305: E/Scringo(5573):    at java.net.InetAddress.getAllByName(InetAddress.java:214)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:461)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:273)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271)
12-21 18:59:34.305: E/Scringo(5573):    at com.scringo.utils.ScringoHttpFetcher.getResponseStr(ScringoHttpFetcher.java:132)
12-21 18:59:34.305: E/Scringo(5573):    at com.scringo.utils.ScringoJsonFetcher.handleResponse(ScringoJsonFetcher.java:59)
12-21 18:59:34.305: E/Scringo(5573):    at com.scringo.utils.ScringoJsonFetcher.run(ScringoJsonFetcher.java:40)
12-21 18:59:34.305: E/Scringo(5573): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.io.Posix.getaddrinfo(Native Method)
12-21 18:59:34.305: E/Scringo(5573):    at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
12-21 18:59:34.305: E/Scringo(5573):    at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
12-21 18:59:34.305: E/Scringo(5573):    ... 18 more
12-21 18:59:34.305: E/Scringo(5573): Caused by: libcore.io.ErrnoException: getaddrinfo failed: EACCES (Permission denied)
12-21 18:59:34.305: E/Scringo(5573):    ... 21 more
.
.
.

请帮忙...

更仔细地检查日志,您会发现您需要将 INTERNET 权限添加到您的 AndroidManifest .xml:

<uses-permission android:name="android.permission.INTERNET" />
当您将 Scringo

项目库设置为项目的依赖项并在 project.properties 中设置manifestmerger.enabled=true时,它会将您的清单与 Scringo 清单合并。在 Scringo 清单中,已经添加了 INTERNET 权限。如果合并中存在某种错误,您将在 Eclipse 控制台中看到它。

合并的清单应该在你的 bin 文件夹中,看看它是否正确合并,以及那里是否存在 INTERNET 权限。

顺便说一句,有时"清理"项目会有所帮助;-)

相关内容

  • 没有找到相关文章

最新更新