Android 开发之错误整理java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10088 nor current process has android.permission.READ_PHONE_STATE.
时间:2014-04-29 18:16:15
收藏:0
阅读:1324
java.lang.SecurityException:
Requires READ_PHONE_STATE: Neither user 10088 nor current process has
android.permission.READ_PHONE_STATE.
今天写了一款发短信的软件,拿了个酷派5879,试了下,结果不能用,把try{}catch{}去掉了,报这个错误,
android.permission.READ_PHONE_STATE.没有READ_PHONE_STATE权限,于是在manifest.xml中添加权限。
<uses-permission
android:name="android.permission.READ_PHONE_STATE" />
再次运行可以了。
错误日志:
04-28
22:23:07.862: E/Trace(26834): error opening trace file: No such file or
directory (2)
04-28
22:23:18.152: E/AndroidRuntime(26834): FATAL EXCEPTION: main
04-28
22:23:18.152: E/AndroidRuntime(26834):
java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10088 nor
current process has android.permission.READ_PHONE_STATE.
04-28
22:23:18.152: E/AndroidRuntime(26834): at
android.os.Parcel.readException(Parcel.java:1425)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
android.os.Parcel.readException(Parcel.java:1379)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:736)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
android.telephony.SmsManager.sendTextMessage(SmsManager.java:88)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
com.dava.helpmywife.sendMessage.sendMessage(sendMessage.java:36)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
com.dava.helpmywife.inits$3.onClick(inits.java:82)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:171)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
android.os.Handler.dispatchMessage(Handler.java:99)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
android.os.Looper.loop(Looper.java:137)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
android.app.ActivityThread.main(ActivityThread.java:4802)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
java.lang.reflect.Method.invokeNative(Native Method)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
java.lang.reflect.Method.invoke(Method.java:511)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
04-28
22:23:18.152: E/AndroidRuntime(26834): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
04-28
22:23:18.152: E/AndroidRuntime(26834): at dalvik.system.NativeStart.main(Native
Method)
评论(0)