首页 / 浏览问题 / 移动GIS / 问题详情
android移动端,初始化失败
66EXP 2020年10月30日
运行后报SecurityException错误,动态运行权限中 定位和文件读写权限都给了

设备:MI MAX 3

系统版本:android10

MIUI版本:MIUI12.0.1稳定版

/**************这是刚创建安装程序时出现的错误*********************/

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.deepoit.natureintegrate, PID: 16120
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=10, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.deepoit.natureintegrate/com.deepoit.natureintegrate.MainActivity}: java.lang.SecurityException: getDeviceId: The user 10388 does not meet the requirements to access device identifiers.
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4938)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4979)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:224)
        at android.app.ActivityThread.main(ActivityThread.java:7562)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
     Caused by: java.lang.SecurityException: getDeviceId: The user 10388 does not meet the requirements to access device identifiers.
        at android.os.Parcel.createException(Parcel.java:2074)
        at android.os.Parcel.readException(Parcel.java:2042)
        at android.os.Parcel.readException(Parcel.java:1990)
        at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceId(ITelephony.java:10389)
        at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:1619)
        at com.supermap.data.Environment.checkDevice_New(Environment.java:829)
        at com.supermap.data.Environment.initialization(Environment.java:621)
        at com.deepoit.natureintegrate.MainActivity.initEnvironment(MainActivity.java:292)
        at com.deepoit.natureintegrate.MainActivity.onRequestPermissionsResult(MainActivity.java:338)
        at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8408)
        at android.app.Activity.dispatchActivityResult(Activity.java:8253)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4931)

/***********************************/

/*************这是安装后第二次打开出现的错误**********************/

 java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=10, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.deepoit.natureintegrate/com.deepoit.natureintegrate.MainActivity}: java.lang.SecurityException: getUniqueDeviceId: The user 10160 does not meet the requirements to access device identifiers.
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5589)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:5630)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8349)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
     Caused by: java.lang.SecurityException: getUniqueDeviceId: The user 10160 does not meet the requirements to access device identifiers.
        at android.os.Parcel.createException(Parcel.java:2071)
        at android.os.Parcel.readException(Parcel.java:2039)
        at android.os.Parcel.readException(Parcel.java:1987)
        at com.android.internal.telephony.IHwTelephony$Stub$Proxy.getUniqueDeviceId(IHwTelephony.java:3156)
        at android.telephony.HwTelephonyManagerInner.getUniqueDeviceId(HwTelephonyManagerInner.java:1251)
        at android.telephony.HwInnerTelephonyManagerImpl.getUniqueDeviceId(HwInnerTelephonyManagerImpl.java:358)
        at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:1653)
        at com.supermap.data.Environment.checkDevice_New(Environment.java:829)
        at com.supermap.data.Environment.initialization(Environment.java:621)
        at com.deepoit.natureintegrate.MainActivity.initEnvironment(MainActivity.java:292)
        at com.deepoit.natureintegrate.MainActivity.onRequestPermissionsResult(MainActivity.java:338)
        at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8566)
        at android.app.Activity.dispatchActivityResult(Activity.java:8416)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:5582)

/***********************************/

1个回答

您好,这个还是权限的问题。看下工程里面使用的targetSDKVersion的版本是多少,如果使用的是Android10,由于Android10采用的是沙盒机制,每个app对应一个文件夹,采用之前设置许可的方式就不可取了。需要把许可放在app对应的文件夹里面。该路径在手机内部存储/Android/data下
9,242EXP 2020年10月30日
targetSdkVersion 29。你的意思是许可文件夹要放在/Android/data路径下读取了吗?
是的,如果你们需要使用Android的新特性,就必须把许可放在指定的文件夹下,如果不使用建议将sdkversion降至28
谢谢帮助,降到28能进入程序了
指定的文件夹是要放到哪个文件夹下啊?
...