首页 / 浏览问题 / 移动GIS / 问题详情
Android Mapview报错
45EXP 2022年07月05日
我每次导入shp数据后,或者添加天地图的时候,返回到主页面都会整个app闪退。具体报错如下:

  Process: com.example.resourcethrough, PID: 25493
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.resourcethrough/com.example.resourcethrough.MainActivity}: android.view.InflateException: Binary XML file line #69 in com.example.resourcethrough:layout/activity_main: Binary XML file line #69 in com.example.resourcethrough:layout/activity_main: Error inflating class com.supermap.mapping.MapView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4060)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4247)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
        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:2613)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8668)
        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:1109)
     Caused by: android.view.InflateException: Binary XML file line #69 in com.example.resourcethrough:layout/activity_main: Binary XML file line #69 in com.example.resourcethrough:layout/activity_main: Error inflating class com.supermap.mapping.MapView
     Caused by: android.view.InflateException: Binary XML file line #69 in com.example.resourcethrough:layout/activity_main: Error inflating class com.supermap.mapping.MapView
     Caused by: java.lang.reflect.InvocationTargetExceptionat java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
        at android.view.LayoutInflater.createView(LayoutInflater.java:864)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1016)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:971)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1133)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1136)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1136)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:692)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
        at com.android.internal.policy.HwPhoneLayoutInflater.inflate(HwPhoneLayoutInflater.java:138)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:483)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.example.resourcethrough.MainActivity.onCreate(MainActivity.java:208)
        at android.app.Activity.performCreate(Activity.java:8214)
        at android.app.Activity.performCreate(Activity.java:8202)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4033)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4247)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
        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:2613)
        at android.os.Handler.dispatchMessage(Handler.java:110)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8668)

这个是布局文件的Mapview报错,是啥原因呢 是因为我的Activity的启动模式是SingleTop的原因嘛

1个回答

您好,请问您是用在主页面初始化添加小窗口的方式实现导入shp与添加天地图的功能按钮吗,如果是的,那么建议您在初始化小窗口时根据主页面的content来实现初始化。

希望可以帮助到您。
3,685EXP 2022年07月05日
不行还是闪退的,这个bug在导入导入过的shp文件和重复添加天地图在线影像的时候会出现,偶尔一些时候在其他情况也会出现
您那边能否debug进入onCreateViewHolder看看其中参数是否有空的呢,就是因为空值导致的,您使用LayoutInflater时因该保证其在容器中才有意义
debug了,闪退的时候他不走这俩个方法。整个页面之间闪退掉。这俩是一个dialog弹窗列表的适配器。只有点击按钮的时候才会触发他俩。
请问您那边方便提供可以复现的demo吗,这边私信您邮箱地址
发你得邮箱了。怎么复现也告诉你了
...