简体   繁体   中英

How to make the application keep alive? It shows a strange error after running

Here is my code, i am trying to run in the Android. It runs and then gives that strange error dialog.

在此处输入图片说明

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");
    }
}

ERROR:

[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 }

On the screen when i run i get error:

"Sorr! The application HelloNeon (process com.example.neon) has stopped unexpectedly. Please try again."

I guess the error is "The application HellowNeon (process com.example.neon) has stopped unexpectedly Please Try again :-)". So you can

Filter your log to just Error and look for FATAL EXCEPTION

Also You can debug by setting breakpoints in Eclipse.Select "Debug" rather than the standard "Run", which will allow you to step through and so on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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