首页 / 浏览问题 / 移动GIS / 问题详情
Attempt to invoke virtual method
Lsk
11EXP 2022年10月13日
Process: com.example.supermapimobile2d, PID: 7308 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.supermapimobile2d/com.example.supermapimobile2d.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'com.supermap.data.Datasets com.supermap.data.Datasource.getDatasets()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2668) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6176) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.supermap.data.Datasets com.supermap.data.Datasource.getDatasets()' on a null object reference at com.example.supermapimobile2d.MainActivity.onCreate(MainActivity.java:74) at android.app.Activity.performCreate(Activity.java:6692) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2621) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6176) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) I/Supermap: true I/art: Do partial code cache collection, code=30KB, data=21KB After code cache collection, code=29KB, data=20KB Increasing code cache capacity to 128KB

1个回答

您好,这里看您的报错信息第二行显示com.example.supermapimobile2d.MainActivity里面打开数据源为null,

建议您 1.如果打开的是文件型数据源检查数据集名称是否正确,

2.如果打开的是工作空间,建议您用桌面打开工作空间,检查数据源中数据集名称是否正确

3.附上报错代码,只有报错信息看不清楚呢
3,810EXP 2022年10月13日
...