首页 / 浏览问题 / 移动GIS / 问题详情
app初次安装后闪退
15EXP 2019年06月28日

使用产品:imobile 9D SP1 操作系统:win10 x64

手机: 5.1

按照SuperMap iMobile 9D SP1 for Android Guide 复制代码,添加数据、临时许可和最基础的功能后,在手机安装完软件以后完全打不开,一直闪退。以下是运行时的错误信息,和许可位置。

06-28 12:27:24.045: E/AndroidRuntime(4430): FATAL EXCEPTION: main
06-28 12:27:24.045: E/AndroidRuntime(4430): Process: com.example.supermapimobiledemo, PID: 4430
06-28 12:27:24.045: E/AndroidRuntime(4430): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.supermapimobiledemo/com.example.supermapimobiledemo.MainActivity}: java.lang.IllegalArgumentException: /Storage/SuperMap/license/ is not a correct directory
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2675)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2766)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.ActivityThread.access$1000(ActivityThread.java:197)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1611)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.os.Handler.dispatchMessage(Handler.java:111)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.os.Looper.loop(Looper.java:224)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.ActivityThread.main(ActivityThread.java:5958)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at java.lang.reflect.Method.invoke(Native Method)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at java.lang.reflect.Method.invoke(Method.java:372)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)
06-28 12:27:24.045: E/AndroidRuntime(4430): Caused by: java.lang.IllegalArgumentException: /Storage/SuperMap/license/ is not a correct directory
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at com.supermap.data.Environment.setLicensePath(Environment.java:509)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at com.example.supermapimobiledemo.MainActivity.onCreate(MainActivity.java:53)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.Activity.performCreate(Activity.java:6251)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2622)
06-28 12:27:24.045: E/AndroidRuntime(4430): 	... 10 more

06-30 15:02:43.634: E/com.loogear.push.service.DaemonCallbackImpl(27286): manufac:OPPO
06-30 15:02:47.061: E/NetworkStatsSessionProxy(29242): stats == null
06-30 15:02:48.606: E/CellLocation(1863): create GsmCellLocation
06-30 15:02:48.648: E/LIGHT(942): AmbiLightSensor: get als value 7
06-30 15:02:48.648: E/LIGHT(942): AmbiLightSensor: report als event
06-30 15:02:48.648: E/PROXIMITY(942): ProximitySensor: unknown event (type=3, code=0)
06-30 15:02:48.648: E/PROXIMITY(942): ProximitySensor: invalid EV_SYN
06-30 15:02:50.657: E/LIGHT(942): AmbiLightSensor: get als value 6
06-30 15:02:50.657: E/LIGHT(942): AmbiLightSensor: report als event
06-30 15:02:50.657: E/PROXIMITY(942): ProximitySensor: unknown event (type=3, code=0)
06-30 15:02:50.657: E/PROXIMITY(942): ProximitySensor: invalid EV_SYN
06-30 15:02:53.636: E/com.loogear.push.service.DaemonCallbackImpl(27286): manufac:OPPO
06-30 15:02:58.258: E/CellLocation(1863): create GsmCellLocation
06-30 15:02:58.684: E/LIGHT(942): AmbiLightSensor: get als value 7
06-30 15:02:58.684: E/LIGHT(942): AmbiLightSensor: report als event
06-30 15:02:58.684: E/PROXIMITY(942): ProximitySensor: unknown event (type=3, code=0)
06-30 15:02:58.684: E/PROXIMITY(942): ProximitySensor: invalid EV_SYN
06-30 15:02:59.169: E/NetworkStatsSessionProxy(29242): stats == null
06-30 15:03:00.160: E/CellLocation(1863): create GsmCellLocation
06-30 15:03:00.185: E/LIGHT(942): AmbiLightSensor: get als value 6
06-30 15:03:00.185: E/LIGHT(942): AmbiLightSensor: report als event
06-30 15:03:00.185: E/PROXIMITY(942): ProximitySensor: unknown event (type=3, code=0)
06-30 15:03:00.185: E/PROXIMITY(942): ProximitySensor: invalid EV_SYN
06-30 15:03:01.927: E/CellLocation(1863): create GsmCellLocation
06-30 15:03:03.639: E/com.loogear.push.service.DaemonCallbackImpl(27286): manufac:OPPO
06-30 15:03:03.843: E/CellLocation(1863): create GsmCellLocation
06-30 15:03:05.267: E/CellLocation(1863): create GsmCellLocation
06-30 15:03:06.565: E/CellLocation(1863): create GsmCellLocation
06-30 15:03:06.777: E/LIGHT(942): AmbiLightSensor: unknown event (type=2, code=2)
06-30 15:03:06.777: E/LIGHT(942): AmbiLightSensor: unknown event (type=2, code=1)
06-30 15:03:06.777: E/LIGHT(942): AmbiLightSensor: invalid EV_SYN
06-30 15:03:06.777: E/PROXIMITY(942): ProximitySensor: report prox event
06-30 15:03:07.082: E/LIGHT(942): AmbiLightSensor: unknown event (type=2, code=2)
06-30 15:03:07.082: E/LIGHT(942): AmbiLightSensor: unknown event (type=2, code=1)
06-30 15:03:07.082: E/LIGHT(942): AmbiLightSensor: invalid EV_SYN
06-30 15:03:07.082: E/PROXIMITY(942): ProximitySensor: report prox event
06-30 15:03:08.622: E/CellLocation(1863): create GsmCellLocation

1个回答

您好,看您的这个错误日志是因为你存放许可的路径是一个错误的路径。检查一下你许可的路径和你代码中的路径是否一致。可以调试一下看能否获取到这个路径下的文件信息。
9,232EXP 2019年06月28日

路径应该没有错误,其他的文件在对应位置自动生成了

package com.example.supermapimobiledemo;
import android.app.Activity; 
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;


import android.view.View; 
import android.view.View.OnClickListener; 
import android.widget.ZoomControls;
import com.supermap.data.Environment;  
import com.supermap.data.Workspace; 
import com.supermap.data.WorkspaceConnectionInfo; 
import com.supermap.data.WorkspaceType; 
import com.supermap.mapping.MapControl; 
import com.supermap.mapping.MapView;


public class MainActivity extends Activity { 
     private MapControl m_mapControl = null; 
     private Workspace m_wokspace; 
     private MapView m_mapView; 
     private ZoomControls m_zoom; 
     @Override 
     public void onCreate(Bundle savedInstanceState) { 
         super.onCreate(savedInstanceState); 
         //设置一些系统需要用到的路径
        String rootPath =  
        	   android.os.Environment.getExternalStorageDirectory().getAbsolutePath(); 
        		          Environment.setLicensePath(rootPath + "/SuperMap/license/"); 
        		          Environment.setTemporaryPath(rootPath + "/SuperMap/temp/"); 
        		          Environment.setWebCacheDirectory(rootPath + "/SuperMap/WebCache/");
        		   
        		          // 组件功能必须在Environment初始化之后才能调用
        		          Environment.initialization(this); 
        		          setContentView(R.layout.activity_main); 
        		          // 打开工作空间
        		          m_wokspace = new Workspace(); 
        		          WorkspaceConnectionInfo info = new WorkspaceConnectionInfo(); 
        		          info.setServer(rootPath + "/SuperMap/SampleData/GeometryInfo/World.smwu"); 
        		          info.setType(WorkspaceType.SMWU); 
        		          m_wokspace.open(info); 
        		          //将地图显示控件和工作空间关联
        		          //打开工作空间中的第二幅地图
        		          String mapName = m_wokspace.getMaps().get(1); 
        		          m_mapControl.getMap().open(mapName); 
        		          m_zoom = (ZoomControls)findViewById(R.id.zoomControls); 
        		          m_mapView = (MapView)findViewById(R.id.Map_view); 
        		          m_zoom.setIsZoomInEnabled(true); 
        		          m_zoom.setIsZoomOutEnabled(true); 
                          // 放大按钮
        		          m_zoom.setOnZoomInClickListener(new OnClickListener(){ 
        		        	   public void onClick(View v) { 
        		        		   m_mapControl.getMap().zoom(2); 
        		        		   m_mapControl.getMap().refresh();  
        		        		   } 
        		        	   }); 
        		          // 缩小按钮
        		          m_zoom.setOnZoomOutClickListener(new OnClickListener(){ 
        		        	   public void onClick(View v) { 
        		        	    m_mapControl.getMap().zoom(0.5); 
        		        	    m_mapControl.getMap().refresh(); 
        		        	   } 
        		        	  }); 
        		        	  m_mapControl.getMap().refresh(); 
        		        	     } 
        		        	} 
        		         //注意:组件功能必须在Environment初始化之后才能调用

您好,把你许可路径下后缀为lic9d的文件删掉,这个是PC端的许可。另外根据你提供的错误日志,可以看出是许可路径的问题,你调试一下代码看能否获取rootPath + "/SuperMap/license/"下的文件个数。如:

File file=new File(basePath + "/SuperMap/license/");

int count= file.listFiles().length;
System.out.println(count);

删掉lic9d后,调试结果为1sad

...