简体   繁体   English

每次我发出一个GET语句时,应用程序都会崩溃。 我怎样才能解决这个问题?

[英]App keeps crashing every time I make a certain GET statement. How can I fix this?

I am really confused as to why I am having this problem. 我真的很困惑为什么我遇到这个问题。 I am very new to android development so I am not really sure where to start when solving this problem. 我对android开发很新,所以我不确定在解决这个问题时从哪里开始。 I have all the required permissions in the manifest file. 我在清单文件中拥有所有必需的权限。 and . 和。

If I use a URL like "http://www.google.com" the app works as it is supposed to work. 如果我使用像"http://www.google.com"这样的网址,该应用程序可以正常工作。 I have tested the URL I am trying to use ( "https://api.discogs.com/users/mrblahblahblacksheep/collection/folders/0/releases?page=1&per_page=1" ) with "https://www.hurl.it/" and it works just fine. 我已经测试了我尝试使用的URL( "https://api.discogs.com/users/mrblahblahblacksheep/collection/folders/0/releases?page=1&per_page=1" )和"https://www.hurl.it/"它工作得很好。 But for some reason when I try and run it with my app it crashes. 但出于某种原因,当我尝试使用我的应用程序运行它时会崩溃。

When a button is pressed myClickHandler is called and sends the url to downloadWebPageTask which starts an ASyncTask. 当按下按钮时,调用myClickHandler并将url发送到downloadWebPageTask,它启动ASyncTask。 This AsyncTank takes the URL and then sends GET request. 此AsyncTank获取URL,然后发送GET请求。 Here is my code. 这是我的代码。

public void myClickHandler(View view) {
    SetText url = new SetText();
    //String string_url = url.createURL(artist_text.getText().toString(), release_text.getText().toString());
    new DownloadWebpageTask().execute("https://api.discogs.com/users/mrblahblahblacksheep/collection/folders/0/releases?page=1&per_page=1");
}

public class DownloadWebpageTask extends AsyncTask<String, Void, String> {
    @Override
    protected String doInBackground(String... urls) {

        String url = urls[0];
        String final_response = "FAILED!";

        HttpClient client = new DefaultHttpClient();
        HttpGet request = new HttpGet(url);

        HttpResponse response;
        try {
            response = client.execute(request);

            final_response = EntityUtils.toString(response.getEntity());
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return final_response;
    }
    // onPostExecute displays the results of the AsyncTask.
    @Override
    protected void onPostExecute(String result) {
        if(result == null) {
            result_text.setText("Try Again");
        } else {
            result_text.setText(result);
        }
    }
}

Finally, here is the error message the logcat prints out when the button is pressed: 最后,这是按下按钮时logcat打印出来的错误消息:

05-20 22:34:50.404      485-550/system_process W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client
05-20 22:34:50.568    2014-2031/blahblahblacksheep.com.searchfordiscogs I/art﹕ Background partial concurrent mark sweep GC freed 4038(228KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 2MB/4MB, paused 73.938ms total 138.022ms
05-20 22:34:50.791    2014-2170/blahblahblacksheep.com.searchfordiscogs A/libc﹕ Fatal signal 4 (SIGILL), code 2, fault addr 0xb721f5ce in tid 2170 (AsyncTask #5)
05-20 22:34:50.893        87-87/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-20 22:34:50.893        87-87/? I/DEBUG﹕ Build fingerprint: 'generic/vbox86p/vbox86p:5.1/LMY47D/buildbot04091026:userdebug/test-keys'
05-20 22:34:50.893        87-87/? I/DEBUG﹕ Revision: '0'
05-20 22:34:50.893        87-87/? I/DEBUG﹕ ABI: 'x86'
05-20 22:34:50.893        87-87/? I/DEBUG﹕ pid: 2014, tid: 2170, name: AsyncTask #5  >>> blahblahblacksheep.com.searchfordiscogs <<<
05-20 22:34:50.893        87-87/? I/DEBUG﹕ signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0xb721f5ce
05-20 22:34:50.901        87-87/? I/DEBUG﹕ eax a20c201c  ebx a1f012ec  ecx 00000014  edx a20c2018
05-20 22:34:50.905        87-87/? I/DEBUG﹕ esi a1f012e8  edi b73033e4
05-20 22:34:50.905        87-87/? I/DEBUG﹕ xcs 00000073  xds 0000007b  xes 0000007b  xfs 000000a7  xss 0000007b
05-20 22:34:50.905        87-87/? I/DEBUG﹕ eip b721f5ce  ebp 00000010  esp a1f01238  flags 00210202
05-20 22:34:50.905        87-87/? I/DEBUG﹕ backtrace:
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #00 pc 000965ce  /system/lib/libcrypto.so (CRYPTO_memcmp+126)
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #01 pc 0002b1f9  /system/lib/libssl.so (ssl3_read_bytes+1353)
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #02 pc 0001e398  /system/lib/libssl.so (ssl3_get_message+312)
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #03 pc 0001dc16  /system/lib/libssl.so (ssl3_get_finished+70)
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #04 pc 000207ae  /system/lib/libssl.so (ssl3_connect+2222)
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #05 pc 00015cc4  /system/lib/libjavacrypto.so
05-20 22:34:50.905        87-87/? I/DEBUG﹕ #06 pc 003a901c  /data/dalvik-cache/x86/system@framework@boot.oat
05-20 22:34:51.147        87-87/? I/DEBUG﹕ Tombstone written to: /data/tombstones/tombstone_06
05-20 22:34:51.148      485-507/system_process I/BootReceiver﹕ Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
05-20 22:34:51.223      485-525/system_process W/InputDispatcher﹕ channel '32c3b9fd blahblahblacksheep.com.searchfordiscogs/blahblahblacksheep.com.searchfordiscogs.SearchForDiscogs (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-20 22:34:51.223      485-525/system_process E/InputDispatcher﹕ channel '32c3b9fd blahblahblacksheep.com.searchfordiscogs/blahblahblacksheep.com.searchfordiscogs.SearchForDiscogs (server)' ~ Channel is unrecoverably broken and will be disposed!
05-20 22:34:51.292      485-502/system_process I/ActivityManager﹕ Process blahblahblacksheep.com.searchfordiscogs (pid 2014) has died
05-20 22:34:51.292     485-1004/system_process I/WindowState﹕ WIN DEATH: Window{32c3b9fd u0 blahblahblacksheep.com.searchfordiscogs/blahblahblacksheep.com.searchfordiscogs.SearchForDiscogs}
05-20 22:34:51.292     485-1004/system_process W/InputDispatcher﹕ Attempted to unregister already unregistered input channel '32c3b9fd blahblahblacksheep.com.searchfordiscogs/blahblahblacksheep.com.searchfordiscogs.SearchForDiscogs (server)'
05-20 22:34:51.294      485-502/system_process W/ActivityManager﹕ Force removing ActivityRecord{31d393c7 u0 blahblahblacksheep.com.searchfordiscogs/.SearchForDiscogs t55}: app died, no saved state
05-20 22:34:51.295        95-95/? I/Zygote﹕ Process 2014 exited due to signal (4)
05-20 22:34:51.302      190-190/? W/SurfaceFlinger﹕ couldn't log to binary event log: overflow.
05-20 22:34:51.383      485-535/system_process I/OpenGLRenderer﹕ Initialized EGL, version 1.4
05-20 22:34:51.453      746-983/com.android.launcher3 W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-20 22:34:51.453      746-983/com.android.launcher3 W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa08b01a0, error=EGL_SUCCESS
05-20 22:34:51.470      485-535/system_process W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-20 22:34:51.470      485-535/system_process W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0x9f46ac20, error=EGL_SUCCESS
05-20 22:34:51.559      485-535/system_process W/EGL_emulation﹕ eglSurfaceAttrib not implemented
05-20 22:34:51.559      485-535/system_process W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0x9f46ac20, error=EGL_SUCCESS
05-20 22:34:52.017      746-983/com.android.launcher3 W/OpenGLRenderer﹕ Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
05-20 22:34:53.753      485-550/system_process W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client
05-20 22:34:53.807      485-535/system_process D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa1b07200 (RippleDrawable) with handle 0xaf28d7f0
05-20 22:34:53.815     485-1004/system_process W/InputMethodManagerService﹕ Got RemoteException sending setActive(false) notification to pid 2014 uid 10060

Thank you for taking a look. 谢谢你看看。

Little late, but SSL is complex protocol with different encryption schemes, so different sites can trigger different code paths. 稍晚,但SSL是具有不同加密方案的复杂协议,因此不同的站点可以触发不同的代码路径。 In this case, it looks like your libcrypto was compiled for a system with more advanced capabilities than you have - maybe it wants SSE4 and your CPU doesn't have those instructions. 在这种情况下,看起来您的libcrypto是为具有比您更高级功能的系统编译的 - 也许它想要SSE4并且您的CPU没有这些指令。

What CPU are you using? 你用的CPU是什么? You'll need a fairly advanced CPU to support x86_64. 您需要一个相当高级的CPU来支持x86_64。 Even the x86 Android ABI needs a 64 bit chip (technically it needs instructions that are only on Atom CPUs or 64 bit desktop CPUs). 即使x86 Android ABI也需要一个64位芯片(从技术上讲,它需要仅在Atom CPU或64位桌面CPU上的指令)。 Try changing your Android image to plain x86. 尝试将您的Android图像更改为纯x86。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM