问题:
java.lang.RuntimeException: Unable to start activity ComponentInfo{chapter05.qst.com.mobileguard/chapter05.qst.com.mobileguard.activity.Setup2Activity}: java.lang.SecurityException: getIccSerialNumber: Neither user 10060 nor current process has android.permission.READ_PHONE_STATE.
原因:未知
解决:
(网上解决办法:in your manifest, you need to add followong permission in order to read phone number:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
我的按照上面的方法没有解决,但是注释掉下面这两行就可以了:
//TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);//注意此处是phon不是phone
//simSerialNumber=tm.getSimSerialNumber();