简体   繁体   中英

Unfortunately (app) has stopped android developer error

I am getting an "unfortunately (app) has stopped" error when I try to run my app on my android phone. The app is supposed to provide an easy interface for controlling a arduino with a bluetooth module Below is my Logcat. Please provide help with this error, I am a first time eclipse user so as many details as possible would be great.

04-12 14:14:54.848: D/AndroidRuntime(20026): Shutting down VM
04-12 14:14:54.848: W/dalvikvm(20026): threadid=1: thread exiting with uncaught  exception (group=0x415a9b90)
04-12 14:14:54.858: E/AndroidRuntime(20026): FATAL EXCEPTION: main
04-12 14:14:54.858: E/AndroidRuntime(20026): Process: com.example.fridgeshoot, PID: 20026
04-12 14:14:54.858: E/AndroidRuntime(20026): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fridgeshoot/com.example.fridgeshoot.MainActivity}: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10117 nor current process has android.permission.BLUETOOTH.
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.ActivityThread.access$700(ActivityThread.java:135)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.os.Handler.dispatchMessage(Handler.java:102)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.os.Looper.loop(Looper.java:137)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.ActivityThread.main(ActivityThread.java:4998)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at java.lang.reflect.Method.invokeNative(Native Method)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at java.lang.reflect.Method.invoke(Method.java:515)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at dalvik.system.NativeStart.main(Native Method)
04-12 14:14:54.858: E/AndroidRuntime(20026): Caused by: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10117 nor current process has android.permission.BLUETOOTH.
04-12 14:14:54.858: E/AndroidRuntime(20026):    at    android.os.Parcel.readException(Parcel.java:1461)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.os.Parcel.readException(Parcel.java:1415)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.bluetooth.IBluetooth$Stub$Proxy.isEnabled(IBluetooth.java:575)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.bluetooth.BluetoothAdapter.isEnabled(BluetoothAdapter.java:452)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at com.example.fridgeshoot.MainActivity.checkBTState(MainActivity.java:180)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at com.example.fridgeshoot.MainActivity.onCreate(MainActivity.java:53)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.Activity.performCreate(Activity.java:5243)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-12 14:14:54.858: E/AndroidRuntime(20026):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
04-12 14:14:54.858: E/AndroidRuntime(20026):    ... 11 more
04-12 14:21:20.479: D/AndroidRuntime(20303): Shutting down VM
04-12 14:21:20.479: W/dalvikvm(20303): threadid=1: thread exiting with uncaught exception (group=0x415a9b90)
04-12 14:21:20.479: E/AndroidRuntime(20303): FATAL EXCEPTION: main
04-12 14:21:20.479: E/AndroidRuntime(20303): Process: com.example.fridgeshoot, PID: 20303
04-12 14:21:20.479: E/AndroidRuntime(20303): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fridgeshoot/com.example.fridgeshoot.MainActivity}: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10117 nor current process has android.permission.BLUETOOTH.
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.ActivityThread.access$700(ActivityThread.java:135)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.os.Handler.dispatchMessage(Handler.java:102)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.os.Looper.loop(Looper.java:137)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.ActivityThread.main(ActivityThread.java:4998)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at java.lang.reflect.Method.invokeNative(Native Method)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at java.lang.reflect.Method.invoke(Method.java:515)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at dalvik.system.NativeStart.main(Native Method)
04-12 14:21:20.479: E/AndroidRuntime(20303): Caused by: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10117 nor current process has android.permission.BLUETOOTH.
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.os.Parcel.readException(Parcel.java:1461)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.os.Parcel.readException(Parcel.java:1415)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.bluetooth.IBluetooth$Stub$Proxy.isEnabled(IBluetooth.java:575)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.bluetooth.BluetoothAdapter.isEnabled(BluetoothAdapter.java:452)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at com.example.fridgeshoot.MainActivity.checkBTState(MainActivity.java:180)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at com.example.fridgeshoot.MainActivity.onCreate(MainActivity.java:53)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.Activity.performCreate(Activity.java:5243)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-12 14:21:20.479: E/AndroidRuntime(20303):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
04-12 14:21:20.479: E/AndroidRuntime(20303):    ... 11 more
04-12 14:21:20.489: I/Process(20303): Sending signal. PID: 20303 SIG: 9
04-12 14:30:39.706: W/ActivityThread(20973): Application com.example.fridgeshoot is waiting for the debugger on port 8100...
04-12 14:30:39.716: I/System.out(20973): Sending WAIT chunk
04-12 14:30:39.916: I/dalvikvm(20973): Debugger is active
04-12 14:30:39.916: I/System.out(20973): Debugger has connected
04-12 14:30:39.926: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:40.127: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:40.327: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:40.527: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:40.727: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:40.928: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:41.128: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:41.338: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:41.538: I/System.out(20973): waiting for debugger to settle...
04-12 14:30:41.738: I/System.out(20973): debugger has settled (1447)
04-12 14:30:42.669: D/dalvikvm(20973): threadid=1: still suspended after undo (sc=1 dc=1)

The error message is very specific:

Need BLUETOOTH permission: Neither user 10117 nor current process has android.permission.BLUETOOTH.

You need to declare that permission in your application's manifest.

As chrylis already mentioned, error-message speaks for itself: Need BLUETOOTH permission

Your AndroidManifest.xml should be like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.appname" >

<uses-permission android:name="android.permission.BLUETOOTH"/>
<application
    <<<there goes the rest of manifest>>>

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