最近在做一个OPC的安卓客户端,需要用到第三方jar包,我新建了一个空工程,将jar包加入到工程中,加入方法是在工程中新建一个libs文件夹,这些jar包便自动同步到Android Dependencies中了,
我直接运行这个新工程,出现了如下错误
[2014-10-12 10:51:03 - OpcClient02] Dx
EXCEPTION FROM SIMULATION:
[2014-10-12 10:51:03 - OpcClient02] Dx local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type java.lang.Object[]. This is symptomatic of .class transformation tools that ignore local variable information.
[2014-10-12 10:51:03 - OpcClient02] Dx ...at bytecode offset 000000c7
locals[0000]: Lch/qos/logback/classic/gaffer/ComponentDelegate;
locals[0001]: [Ljava/lang/Object;
locals[0002]: [Lorg/codehaus/groovy/runtime/callsite/CallSite;
locals[0003]: Ljava/lang/String;
locals[0004]: Ljava/lang/Class;
locals[0005]: Lgroovy/lang/Closure;
locals[0006]: <invalid>
stack[top0]: Ljava/lang/Object;
...while working on block 00c6
...while working on method analyzeArgs:([Ljava/lang/Object;)Ljava/lang/Object;
...while processing analyzeArgs ([Ljava/lang/Object;)Ljava/lang/Object;
...while processing ch/qos/logback/classic/gaffer/ComponentDelegate.class
[2014-10-12 10:51:05 - OpcClient02] Dx 1 error; aborting
[2014-10-12 10:51:05 - OpcClient02] Conversion to Dalvik format failed with error 1
google了好久没找到解决办法,真心求助
------解决思路----------------------
Caused by: android.os.NetworkOnMainThreadException
在主线程调用了网络,你可以先使用
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
允许在主线程使用网络,但是不建议这么使用
------解决思路----------------------
Permission denied
你设置了网络连接的权限没有