0

我制作了一个简单的 Android 应用程序,它试图通过单击按钮打开一个 URL(任何带有输入的 URL 都可以)。我使用的代码是这样的:

btnTest = (Button)findViewById(R.id.btnTest);
    btnTest.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            HelloActivity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")));
        }
    });

问题是在运行平台 4.0.3 的 Android 模拟器中,每次我尝试使用软键盘将文本输入网络时,模拟器都会崩溃。在运行 Platform 2.3.3 的模拟器中不会出现此问题。我试过很多网站,它的行为都是一样的。

顺便说一句,这是 logcat :

02-22 09:35:51.434: I/ActivityManager(81): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.eatmicco.Training/.HelloActivity} from pid 212
02-22 09:35:51.444: D/PermissionCache(36): checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (623 us)
02-22 09:35:51.704: D/dalvikvm(81): GC_FOR_ALLOC freed 149K, 7% free 11999K/12871K, paused 79ms
02-22 09:35:51.714: I/dalvikvm-heap(81): Grow heap (frag case) to 11.914MB for 129616-byte allocation
02-22 09:35:51.844: D/dalvikvm(81): GC_FOR_ALLOC freed 745K, 13% free 11380K/12999K, paused 68ms
02-22 09:35:51.913: D/dalvikvm(478): Not late-enabling CheckJNI (already on)
02-22 09:35:51.944: I/ActivityManager(81): Start proc com.eatmicco.Training for activity com.eatmicco.Training/.HelloActivity: pid=478 uid=10048 gids={1015}
02-22 09:35:51.954: D/(81): HostConnection::get() New Host Connection established 0xbdd28, tid 123
02-22 09:35:52.094: W/NetworkManagementSocketTagger(81): setKernelCountSet(10048, 1) failed with errno -2
02-22 09:35:52.124: D/OpenGLRenderer(212): Flushing caches (mode 1)
02-22 09:35:52.334: V/PhoneStatusBar(151): setLightsOn(true)
02-22 09:35:52.533: W/InputManagerService(81): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@415554e8 (uid=10013 pid=212)
02-22 09:35:52.533: D/(478): HostConnection::get() New Host Connection established 0x15c708, tid 478
02-22 09:35:52.593: D/OpenGLRenderer(212): Flushing caches (mode 0)
02-22 09:35:52.704: I/Process(81): Sending signal. PID: 478 SIG: 3
02-22 09:35:52.704: I/dalvikvm(478): threadid=3: reacting to signal 3
02-22 09:35:52.714: I/dalvikvm(478): Wrote stack traces to '/data/anr/traces.txt'
02-22 09:35:53.004: I/ActivityManager(81): Displayed com.eatmicco.Training/.HelloActivity: +1s114ms
02-22 09:35:53.154: W/NetworkManagementSocketTagger(81): setKernelCountSet(10013, 0) failed with errno -2
02-22 09:35:54.204: I/ActivityManager(81): START {act=android.intent.action.VIEW dat=http://www.google.com cmp=com.android.browser/.BrowserActivity} from pid 478
02-22 09:35:54.573: I/ActivityManager(81): Start proc com.android.browser for activity com.android.browser/.BrowserActivity: pid=491 uid=10002 gids={3003, 1015}
02-22 09:35:54.673: W/NetworkManagementSocketTagger(81): setKernelCountSet(10002, 1) failed with errno -2
02-22 09:35:54.933: I/ActivityThread(491): Pub com.android.browser;browser: com.android.browser.provider.BrowserProvider2
02-22 09:35:54.984: I/ActivityThread(491): Pub com.android.browser.home: com.android.browser.homepages.HomeProvider
02-22 09:35:54.984: I/ActivityThread(491): Pub com.android.browser.snapshots: com.android.browser.provider.SnapshotProvider
02-22 09:35:55.193: I/Process(81): Sending signal. PID: 491 SIG: 3
02-22 09:35:55.193: I/dalvikvm(491): threadid=3: reacting to signal 3
02-22 09:35:55.303: I/dalvikvm(491): Wrote stack traces to '/data/anr/traces.txt'
02-22 09:35:55.553: D/dalvikvm(491): GC_CONCURRENT freed 257K, 4% free 9281K/9607K, paused 8ms+4ms
02-22 09:35:55.603: E/ActivityThread(491): Failed to find provider info for com.google.settings
02-22 09:35:55.603: E/ActivityThread(491): Failed to find provider info for com.google.settings
02-22 09:35:55.693: I/Process(81): Sending signal. PID: 491 SIG: 3
02-22 09:35:55.693: I/dalvikvm(491): threadid=3: reacting to signal 3
02-22 09:35:55.813: I/dalvikvm(491): Wrote stack traces to '/data/anr/traces.txt'
02-22 09:35:55.893: D/dalvikvm(491): GC_FOR_ALLOC freed 191K, 4% free 9475K/9799K, paused 34ms
02-22 09:35:55.943: D/dalvikvm(491): GC_FOR_ALLOC freed 5K, 4% free 9647K/9991K, paused 31ms
02-22 09:35:55.993: D/dalvikvm(491): GC_FOR_ALLOC freed <1K, 4% free 9818K/10183K, paused 42ms
02-22 09:35:56.023: D/dalvikvm(491): GC_FOR_ALLOC freed <1K, 4% free 9989K/10375K, paused 35ms
02-22 09:35:56.073: D/dalvikvm(491): GC_FOR_ALLOC freed 1K, 4% free 10162K/10567K, paused 32ms
02-22 09:35:56.114: D/dalvikvm(491): GC_FOR_ALLOC freed <1K, 3% free 10504K/10759K, paused 33ms
02-22 09:35:56.163: E/libEGL(491): call to OpenGL ES API with no current context (logged once per thread)
02-22 09:35:56.183: D/ShaderProgram(491): couldn't load the vertex shader!
02-22 09:35:56.183: E/libEGL(491): call to OpenGL ES API with no current context (logged once per thread)
02-22 09:35:56.183: D/ShaderProgram(491): couldn't load the vertex shader!
02-22 09:35:56.183: E/libEGL(491): call to OpenGL ES API with no current context (logged once per thread)
02-22 09:35:56.183: D/ShaderProgram(491): couldn't load the vertex shader!
02-22 09:35:56.183: E/libEGL(491): call to OpenGL ES API with no current context (logged once per thread)
02-22 09:35:56.183: D/ShaderProgram(491): couldn't load the vertex shader!
02-22 09:35:56.183: E/libEGL(491): call to OpenGL ES API with no current context (logged once per thread)
02-22 09:35:56.183: D/ShaderProgram(491): couldn't load the vertex shader!
02-22 09:35:56.193: I/Process(81): Sending signal. PID: 491 SIG: 3
02-22 09:35:56.193: I/dalvikvm(491): threadid=3: reacting to signal 3
02-22 09:35:56.233: I/dalvikvm(491): Wrote stack traces to '/data/anr/traces.txt'
02-22 09:35:56.383: D/dalvikvm(491): GC_FOR_ALLOC freed 20K, 3% free 10896K/11143K, paused 57ms
02-22 09:35:56.393: D/WebViewTimersControl(491): onBrowserActivityResume
02-22 09:35:56.393: D/WebViewTimersControl(491): Resuming webview timers, view=com.android.browser.BrowserWebView@41313558
02-22 09:35:56.403: W/BaseUi(491): mMainView is already attached to wrapper in attachTabToContentView!
02-22 09:35:56.413: W/BaseUi(491): mContainer is already attached to content in attachTabToContentView!
02-22 09:35:56.433: V/NFC(491): this device does not have NFC support
02-22 09:35:56.543: D/libEGL(491): loaded /system/lib/egl/libGLES_android.so
02-22 09:35:56.593: D/libEGL(491): loaded /system/lib/egl/libEGL_emulation.so
02-22 09:35:56.593: D/(491): HostConnection::get() New Host Connection established 0x1ec618, tid 491
02-22 09:35:56.643: D/libEGL(491): loaded /system/lib/egl/libGLESv1_CM_emulation.so
02-22 09:35:56.643: D/libEGL(491): loaded /system/lib/egl/libGLESv2_emulation.so
02-22 09:35:56.703: I/Process(81): Sending signal. PID: 491 SIG: 3
02-22 09:35:56.703: I/dalvikvm(491): threadid=3: reacting to signal 3
02-22 09:35:56.793: W/EGL_emulation(491): eglSurfaceAttrib not implemented
02-22 09:35:56.823: D/OpenGLRenderer(491): Enabling debug mode 0
02-22 09:35:56.823: I/dalvikvm(491): Wrote stack traces to '/data/anr/traces.txt'
02-22 09:35:57.214: I/Process(81): Sending signal. PID: 491 SIG: 3
02-22 09:35:57.214: I/dalvikvm(491): threadid=3: reacting to signal 3
02-22 09:35:57.273: I/dalvikvm(491): Wrote stack traces to '/data/anr/traces.txt'
02-22 09:35:57.313: I/ActivityManager(81): Displayed com.android.browser/.BrowserActivity: +2s785ms
02-22 09:35:57.733: E/chromium(491): external/chromium/net/disk_cache/backend_impl.cc:1107: [0222/093557:ERROR:backend_impl.cc(1107)] Critical error found -8
02-22 09:35:57.893: D/dalvikvm(491): GC_CONCURRENT freed 65K, 3% free 11348K/11591K, paused 3ms+21ms
02-22 09:35:57.963: D/dalvikvm(491): GC_FOR_ALLOC freed 10K, 3% free 11337K/11591K, paused 60ms
02-22 09:35:57.963: I/dalvikvm-heap(491): Grow heap (frag case) to 11.765MB for 656656-byte allocation
02-22 09:35:57.993: W/chromium(491): external/chromium/net/disk_cache/storage_block-inl.h:119: [0222/093558:WARNING:storage_block-inl.h(119)] Failed data load.
02-22 09:35:57.993: W/chromium(491): external/chromium/net/disk_cache/storage_block-inl.h:119: [0222/093558:WARNING:storage_block-inl.h(119)] Failed data load.
02-22 09:35:58.003: W/chromium(491): external/chromium/net/disk_cache/storage_block-inl.h:119: [0222/093558:WARNING:storage_block-inl.h(119)] Failed data load.
02-22 09:35:58.033: W/chromium(491): external/chromium/net/disk_cache/storage_block-inl.h:119: [0222/093558:WARNING:storage_block-inl.h(119)] Failed data load.
02-22 09:35:58.053: E/chromium(491): external/chromium/net/disk_cache/entry_impl.cc:904: [0222/093558:ERROR:entry_impl.cc(904)] Failed to save user data
02-22 09:35:58.053: E/chromium(491): external/chromium/net/disk_cache/entry_impl.cc:904: [0222/093558:ERROR:entry_impl.cc(904)] Failed to save user data
02-22 09:35:58.143: D/dalvikvm(491): GC_FOR_ALLOC freed 0K, 3% free 11979K/12295K, paused 121ms
02-22 09:35:58.263: W/Tab(491): Failed to save back/forward list for http://www.google.com
02-22 09:35:58.883: W/NetworkManagementSocketTagger(81): setKernelCountSet(10048, 0) failed with errno -2
02-22 09:36:03.363: D/dalvikvm(165): GC_CONCURRENT freed 118K, 3% free 9760K/9991K, paused 4ms+5ms
02-22 09:36:04.403: D/(165): HostConnection::get() New Host Connection established 0x1e7f50, tid 165
02-22 09:36:04.773: D/dalvikvm(165): GC_FOR_ALLOC freed 143K, 3% free 9844K/10119K, paused 224ms
02-22 09:36:04.803: I/dalvikvm-heap(165): Grow heap (frag case) to 10.241MB for 591376-byte allocation
02-22 09:36:04.913: D/dalvikvm(165): GC_FOR_ALLOC freed 9K, 4% free 10412K/10759K, paused 99ms
02-22 09:36:05.053: D/dalvikvm(165): GC_CONCURRENT freed <1K, 4% free 10413K/10759K, paused 3ms+4ms
02-22 09:36:05.623: D/dalvikvm(151): GC_CONCURRENT freed 174K, 29% free 9975K/13959K, paused 4ms+16ms
02-22 09:36:05.803: D/dalvikvm(81): GC_CONCURRENT freed 278K, 12% free 11569K/12999K, paused 5ms+28ms
: E/(): Device disconnected

谁能告诉我这里有什么问题?

谢谢

4

0 回答 0