首页 / 浏览问题 / 移动GIS / 问题详情
尝试对null对象引用调用虚拟方法
23EXP 2023年07月30日
FATAL EXCEPTION: main                                                                                                    
Process: com.example.tianditu, PID: 32597                                                                                                    
java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.example.tianditu/com.example.tianditu.MainActivity}: 
java.lang.NullPointerException: Attempt to invoke virtual method 'char[] 
java.lang.String.toCharArray()' on a null object reference                                                                                                    	
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3782)                                                                                                    	
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)                                                                                                   	
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)                                                                                                    	
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)                                                                                                    	
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)                                                                                                    	
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)                                                                                                    	
at android.os.Handler.dispatchMessage(Handler.java:106)                                                                                                    	
at android.os.Looper.loopOnce(Looper.java:205)                                                                                                   	
at android.os.Looper.loop(Looper.java:294)                                                                                                    	
at android.app.ActivityThread.main(ActivityThread.java:8176)                                                                                                    	
at java.lang.reflect.Method.invoke(Native Method)                                                                                                    	
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)                                                                                                   	
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)                                                                                                    
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'char[] 
java.lang.String.toCharArray()' on a null object reference                                                                                                   	
at com.supermap.data.Environment.encryptionMac(Environment.java:2283)                                                                                                    	
at com.supermap.data.Environment.writeFile(Environment.java:2312)                                                                                                    	
at com.supermap.data.Environment.checkDevice_New(Environment.java:836)                                                                                                    	
at com.supermap.data.Environment.initialization(Environment.java:626)                                                                                                    	
at com.example.tianditu.MainActivity.onCreate(MainActivity.java:23)                                                                                                    	
at android.app.Activity.performCreate(Activity.java:8595)                                                                                                    	
at android.app.Activity.performCreate(Activity.java:8573)                                                                                                    	
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)                                                                                                    	
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3764)                                                                                                    	
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)                                                                                                     	
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)                                                                                                     	
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)                                                                                                     	
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)                                                                                                     	
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)                                                                                                     	
at android.os.Handler.dispatchMessage(Handler.java:106)                                                                                                     	
at android.os.Looper.loopOnce(Looper.java:205)                                                                                                     	
at android.os.Looper.loop(Looper.java:294)                                                                                                     	
at android.app.ActivityThread.main(ActivityThread.java:8176)                                                                                                     	
at java.lang.reflect.Method.invoke(Native Method)                                                                                                     	
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)                                                                                                     	
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 

许可已配置好

1个回答

您好,请注意工程gradle配置中是否有声明ndk,android sdk版本不高于28,应用是否有读取文件权限
3,745EXP 2023年07月31日
已解决,谢谢
...