IMOBILE 10I 按照示例编写在线试用许可代码后,运行报错
报错信息如下:
E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.wavenet.sewerage, PID: 14043
java.lang.IllegalStateException: Please call com.supermap.data.Environment.initialization() firstly
at com.supermap.data.Environment.getLicenseStatus(Environment.java:1105)
at com.supermap.data.CloudLicenseManager$1.run(CloudLicenseManager.java:136)
按报错提示加上Environment.initialization(this)后报错信息变成了:
E/AndroidRuntime: FATAL EXCEPTION: Thread-6
Process: com.wavenet.sewerage, PID: 29056
java.lang.NoSuchMethodError: No virtual method execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/client/methods/CloseableHttpResponse; in class Lorg/apache/http/impl/client/DefaultHttpClient; or its super classes (declaration of 'org.apache.http.impl.client.DefaultHttpClient' appears in /system/framework/org.apache.http.legacy.jar)
at com.supermap.data.CloudLicenseManager.a(CloudLicenseManager.java:196)
at com.supermap.data.CloudLicenseManager.access$400(CloudLicenseManager.java:67)
at com.supermap.data.CloudLicenseManager$1.run(CloudLicenseManager.java:167)
而且许可也没有生效。
示例代码如下:
String rootPath = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
Environment.setLicensePath(rootPath + "/SuperMap/License");
CloudLicenseManager cloudLicM = CloudLicenseManager.getInstance(this);
String username = "您的Online用户名";
String password = "您的Online登陆密码";
cloudLicM.setLoginCallback(new CloudLicenseManager.LicenseLoginCallback() {
@Override
public void loginSuccess(LicenseStatus arg0) {
// TODO Auto-generated method stub
showMessage("云许可登陆成功: " + arg0.toString());
}
@Override
public void loginFailed(String arg0) {
// TODO Auto-generated method stub
showMessage("云许可登陆失败: " + arg0);
}
});
cloudLicM.login(username, password);