gpt4 book ai didi

java - 如何让应用保持存活?运行后出现奇怪的错误

转载 作者:太空宇宙 更新时间:2023-11-04 11:35:36 25 4
gpt4 key购买 nike

这是我的代码,我试图在 Android 中运行。它运行,然后给出那个奇怪的错误对话框。

enter image description here

package com.example.neon;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloNeon extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
/* Create a TextView and set its content.
* the text is retrieved by calling a native
* function.
*/
TextView tv = new TextView(this);
tv.setText( stringFromJNI() );
setContentView(tv);
}

/* A native method that is implemented by the
* 'helloneon' native library, which is packaged
* with this application.
*/
public native String stringFromJNI();

/* this is used to load the 'helloneon' library on application
* startup. The library has already been unpacked into
* /data/data/com.example.neon/lib/libhelloneon.so at
* installation time by the package manager.
*/
static {
System.loadLibrary("helloneon");
}
}

错误:

[2011-11-12 16:41:13 - HelloJni] Unable to resolve target 'android-8'
[2011-11-12 16:42:37 - HelloJni] ------------------------------
[2011-11-12 16:42:37 - HelloJni] Android Launch!
[2011-11-12 16:42:37 - HelloJni] adb is running normally.
[2011-11-12 16:42:37 - HelloJni] Performing com.example.hellojni.HelloJni activity launch
[2011-11-12 16:42:37 - HelloJni] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:42:45 - HelloJni] Uploading HelloJni.apk onto device '33c20c143608197'
[2011-11-12 16:42:45 - HelloJni] Installing HelloJni.apk...
[2011-11-12 16:42:46 - HelloJni] Success!
[2011-11-12 16:42:46 - HelloJni] Starting activity com.example.hellojni.HelloJni on device 33c20c143608197
[2011-11-12 16:42:46 - HelloJni] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellojni/.HelloJni }
[2011-11-12 16:43:31 - HelloJni] ------------------------------
[2011-11-12 16:43:31 - HelloJni] Android Launch!
[2011-11-12 16:43:31 - HelloJni] adb is running normally.
[2011-11-12 16:43:31 - HelloJni] Performing com.example.hellojni.HelloJni activity launch
[2011-11-12 16:43:31 - HelloJni] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:43:37 - HelloJni] Application already deployed. No need to reinstall.
[2011-11-12 16:43:37 - HelloJni] Starting activity com.example.hellojni.HelloJni on device 33c20c143608197
[2011-11-12 16:43:38 - HelloJni] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellojni/.HelloJni }
[2011-11-12 16:44:18 - HelloJni] ------------------------------
[2011-11-12 16:44:18 - HelloJni] Android Launch!
[2011-11-12 16:44:18 - HelloJni] adb is running normally.
[2011-11-12 16:44:18 - HelloJni] Performing com.example.hellojni.HelloJni activity launch
[2011-11-12 16:44:18 - HelloJni] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:44:23 - HelloJni] Application already deployed. No need to reinstall.
[2011-11-12 16:44:23 - HelloJni] Starting activity com.example.hellojni.HelloJni on device 33c20c143608197
[2011-11-12 16:44:23 - HelloJni] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellojni/.HelloJni }
[2011-11-12 16:45:01 - HelloNeon] Unable to resolve target 'android-3'
[2011-11-12 16:45:15 - HelloJni] ------------------------------
[2011-11-12 16:45:15 - HelloJni] Android Launch!
[2011-11-12 16:45:15 - HelloJni] adb is running normally.
[2011-11-12 16:45:15 - HelloJni] Performing com.example.hellojni.HelloJni activity launch
[2011-11-12 16:45:15 - HelloJni] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:45:17 - HelloJni] Application already deployed. No need to reinstall.
[2011-11-12 16:45:17 - HelloJni] Starting activity com.example.hellojni.HelloJni on device 33c20c143608197
[2011-11-12 16:45:17 - HelloJni] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellojni/.HelloJni }
[2011-11-12 16:45:36 - HelloJni] ------------------------------
[2011-11-12 16:45:36 - HelloJni] Android Launch!
[2011-11-12 16:45:36 - HelloJni] adb is running normally.
[2011-11-12 16:45:36 - HelloJni] Performing com.example.hellojni.HelloJni activity launch
[2011-11-12 16:45:36 - HelloJni] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:45:40 - HelloJni] Application already deployed. No need to reinstall.
[2011-11-12 16:45:40 - HelloJni] Starting activity com.example.hellojni.HelloJni on device 33c20c143608197
[2011-11-12 16:45:40 - HelloJni] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellojni/.HelloJni }
[2011-11-12 16:45:55 - HelloJni] ------------------------------
[2011-11-12 16:45:55 - HelloJni] Android Launch!
[2011-11-12 16:45:55 - HelloJni] adb is running normally.
[2011-11-12 16:45:55 - HelloJni] Performing com.example.hellojni.HelloJni activity launch
[2011-11-12 16:45:55 - HelloJni] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:45:58 - HelloJni] Application already deployed. No need to reinstall.
[2011-11-12 16:45:58 - HelloJni] Starting activity com.example.hellojni.HelloJni on device 33c20c143608197
[2011-11-12 16:45:58 - HelloJni] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellojni/.HelloJni }
[2011-11-12 16:46:16 - HelloNeon] ------------------------------
[2011-11-12 16:46:16 - HelloNeon] Android Launch!
[2011-11-12 16:46:16 - HelloNeon] adb is running normally.
[2011-11-12 16:46:16 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:46:16 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:46:21 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:46:21 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:46:21 - HelloNeon] Uploading HelloNeon.apk onto device '33c20c143608197'
[2011-11-12 16:46:21 - HelloNeon] Installing HelloNeon.apk...
[2011-11-12 16:46:23 - HelloNeon] Success!
[2011-11-12 16:46:23 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:46:23 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }
[2011-11-12 16:46:34 - HelloNeon] ------------------------------
[2011-11-12 16:46:34 - HelloNeon] Android Launch!
[2011-11-12 16:46:34 - HelloNeon] adb is running normally.
[2011-11-12 16:46:34 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:46:34 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:46:36 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:46:36 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:46:37 - HelloNeon] Application already deployed. No need to reinstall.
[2011-11-12 16:46:37 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:46:37 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }
[2011-11-12 16:46:55 - HelloNeon] ------------------------------
[2011-11-12 16:46:55 - HelloNeon] Android Launch!
[2011-11-12 16:46:55 - HelloNeon] adb is running normally.
[2011-11-12 16:46:55 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:46:55 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:46:57 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:46:57 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:46:58 - HelloNeon] Application already deployed. No need to reinstall.
[2011-11-12 16:46:58 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:46:58 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }
[2011-11-12 16:47:07 - HelloNeon] ------------------------------
[2011-11-12 16:47:07 - HelloNeon] Android Launch!
[2011-11-12 16:47:07 - HelloNeon] adb is running normally.
[2011-11-12 16:47:07 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:47:07 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:47:10 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:47:10 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:47:10 - HelloNeon] Application already deployed. No need to reinstall.
[2011-11-12 16:47:10 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:47:10 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }
[2011-11-12 16:49:15 - HelloNeon] ------------------------------
[2011-11-12 16:49:15 - HelloNeon] Android Launch!
[2011-11-12 16:49:15 - HelloNeon] adb is running normally.
[2011-11-12 16:49:15 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:49:15 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:49:18 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:49:18 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:49:18 - HelloNeon] Application already deployed. No need to reinstall.
[2011-11-12 16:49:18 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:49:19 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }
[2011-11-12 16:52:11 - HelloNeon] ------------------------------
[2011-11-12 16:52:11 - HelloNeon] Android Launch!
[2011-11-12 16:52:11 - HelloNeon] adb is running normally.
[2011-11-12 16:52:11 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:52:11 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:52:13 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:52:13 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:52:13 - HelloNeon] Application already deployed. No need to reinstall.
[2011-11-12 16:52:13 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:52:13 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }
[2011-11-12 16:58:47 - HelloNeon] ------------------------------
[2011-11-12 16:58:47 - HelloNeon] Android Launch!
[2011-11-12 16:58:47 - HelloNeon] adb is running normally.
[2011-11-12 16:58:47 - HelloNeon] Performing com.example.neon.HelloNeon activity launch
[2011-11-12 16:58:47 - HelloNeon] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2011-11-12 16:58:52 - HelloNeon] WARNING: Application does not specify an API level requirement!
[2011-11-12 16:58:52 - HelloNeon] Device API version is 11 (Android 3.0.1)
[2011-11-12 16:58:52 - HelloNeon] Application already deployed. No need to reinstall.
[2011-11-12 16:58:52 - HelloNeon] Starting activity com.example.neon.HelloNeon on device 33c20c143608197
[2011-11-12 16:58:53 - HelloNeon] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.neon/.HelloNeon }

当我运行时在屏幕上出现错误:

“抱歉!应用程序 HelloNeon(进程 com.example.neon)意外停止。请重试。”

最佳答案

我猜错误是“应用程序 HellowNeon(进程 com.example.neon)意外停止请重试 :-)”。所以你可以

将您的日志过滤为错误并查找致命异常

您还可以通过在 Eclipse 中设置断点来进行调试。选择“调试”而不是标准的“运行”,这将允许您单步执行等等。

关于java - 如何让应用保持存活?运行后出现奇怪的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8105519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com