经过测试,它适用于非Android程序,但在Android上初始化后立即崩溃。 Log cat也不会产生任何错误消息。我是从CircularFifoBuffer找到的。
有任何明显的问题吗?
编辑:如果我将jar文件添加到libs文件夹(非外部),然后将其添加到构建路径,我会收到此错误消息。但是,如果我在外部添加jar文件,则不会出现此错误。
[2012-08-05 20:56:03 - wifiCollection] Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.collections.SequencedHashMap $ 1)没有附带一个 关联的EnclosingMethod属性。这堂课可能是由一个 没有以现代.class文件格式为目标的编译器。推荐 解决方案是使用最新的编译器从源代码重新编译类 并且没有指定任何" -target"类型选项。无视的后果 这个警告是这个类的反射操作会不正确 表明不是一个内部类。
EDIT2 :
08-05 21:12:48.837:我// system / bin / batteryd(1189):1566474 v_bat 3.678(3.677),i_supply 0.500,i_demand 0.282 => v_bat_idle 3.649(3.649),等级41%(41%,41%),州5
08-05 21:12:50.837:我// system / bin / batteryd(1189):1568477 v_bat 3.678(3.677),i_supply 0.500,i_demand 0.282 => v_bat_idle 3.649(3.649),等级41%(41%,41%),州5
08-05 21:12:51.267:I / ActivityManager(1291):开始活动:意图{act = android.intent.action.MAIN cat = [android.intent.category.LAUNCHER] flg = 0x10200000 cmp = com .jimmyc.summer.wificollection / .WiFiLocationApp bnds = [245,418] [355,553]}
08-05 21:12:51.337:I / dalvikvm(1374):Jit:将JitTable从4096调整为8192
08-05 21:12:51.353:I / ActivityManager(1291):启动proc com.jimmyc.summer.wificollection for activity com.jimmyc.summer.wificollection / .WiFiLocationApp:pid = 1782 uid = 10045 gids = { 1015}
08-05 21:12:51.634:D / dalvikvm(1782):GC_FOR_MALLOC在56ms内释放了1571个对象/ 198264字节
08-05 21:12:51.751:V / LocationManagerService(1291):_ removeUpdates:listener = Receiver {45a6e008 Listener android.os.BinderProxy@45a6e4b8}
08-05 21:12:51.774:V / Tagging(1782):应用程序启动
08-05 21:12:51.774:V / Tagging(1782):检查wifi
08-05 21:12:51.774:V / Tagging(1782):创建新的wifiMode
08-05 21:12:51.782:E / dalvikvm(1782):找不到类' org.apache.commons.collections.buffer.CircularFifoBuffer',从方法com.jimmyc.summer中引用.wificollection.WiFiLocationApp $ wifiMode。
08-05 21:12:51.782:W / dalvikvm(1782):VFY:无法在Lcom / jimmyc / summer / wificollection中解析新实例575(Lorg / apache / commons / collections / buffer / CircularFifoBuffer;) / WiFiLocationApp $ wifiMode;
08-05 21:12:51.782:D / dalvikvm(1782):VFY:在0x0032处替换操作码0x22
08-05 21:12:51.782:D / dalvikvm(1782):VFY:Lcom / jimmyc / summer / wificollection / WiFiLocationApp $ wifiMode;中的死代码0x0034-0041。 (LCOM / jimmyc /夏季/ wificollection / WiFiLocationApp;)V
08-05 21:12:51.790:I / dalvikvm(1782):找不到方法org.apache.commons.collections.buffer.CircularFifoBuffer.isFull,从方法com.jimmyc.summer.wificollection.WiFiLocationApp $引用wifiMode.detectStableEnvironment
08-05 21:12:51.790:W / dalvikvm(1782):VFY:无法解析虚方法3504:Lorg / apache / commons / collections / buffer / CircularFifoBuffer; .isFull()Z
08-05 21:12:51.790:D / dalvikvm(1782):VFY:在0x0006处替换操作码0x74
08-05 21:12:51.790:D / dalvikvm(1782):VFY:Lcom / jimmyc / summer / wificollection / WiFiLocationApp $ wifiMode; .detectStableEnvironment()Z
中的死代码0x0009-023008-05 21:12:51.790:I / dalvikvm(1782):找不到方法org.apache.commons.collections.buffer.CircularFifoBuffer.size,从方法com.jimmyc.summer.wificollection.WiFiLocationApp $引用wifiMode.match
08-05 21:12:51.790:W / dalvikvm(1782):VFY:无法解析虚方法3506:Lorg / apache / commons / collections / buffer / CircularFifoBuffer; .size()I
08-05 21:12:51.790:D / dalvikvm(1782):VFY:在0x000f处替换操作码0x74
08-05 21:12:51.790:D / dalvikvm(1782):VFY:Lcom / jimmyc / summer / wificollection / WiFiLocationApp $ wifiMode; .match()Z
中的死代码0x0012-022708-05 21:12:51.790:I / dalvikvm(1782):找不到方法org.apache.commons.collections.buffer.CircularFifoBuffer.add,从方法com.jimmyc.summer.wificollection.WiFiLocationApp $引用wifiMode.processResults
08-05 21:12:51.790:W / dalvikvm(1782):VFY:无法解析虚方法3502:Lorg / apache / commons / collections / buffer / CircularFifoBuffer; .add(Ljava / lang / Object;) ž
08-05 21:12:51.790:D / dalvikvm(1782):VFY:在0x0020处替换操作码0x6e
08-05 21:12:51.790:D / dalvikvm(1782):VFY:Lcom / jimmyc / summer / wificollection / WiFiLocationApp $ wifiMode; .processResults()V
中的死代码0x0023-005008-05 21:12:51.790:D / dalvikvm(1782):VFY:Lcom / jimmyc / summer / wificollection / WiFiLocationApp $ wifiMode; .processResults()V
中的死代码0x0074-00f008-05 21:12:51.798:W / dalvikvm(1782):VFY:无法找到签名中引用的类(Lorg / apache / commons / collections / buffer / CircularFifoBuffer;)
08-05 21:12:51.798:I / dalvikvm(1782):找不到方法org.apache.commons.collections.buffer.CircularFifoBuffer.iterator,从方法com.jimmyc.summer.wificollection.WiFiLocationApp $引用wifiMode.takeAverage
08-05 21:12:51.798:W / dalvikvm(1782):VFY:无法解析虚方法3505:Lorg / apache / commons / collections / buffer / CircularFifoBuffer; .iterator()Ljava / util / Iterator;
08-05 21:12:51.798:D / dalvikvm(1782):VFY:在0x001b处替换操作码0x74
08-05 21:12:51.798:D / dalvikvm(1782):VFY:Lcom / jimmyc / summer / wificollection / WiFiLocationApp $ wifiMode; .takeAverage(Lorg / apache / commons / collections /)中的死代码0x001e-0419缓冲器/ CircularFifoBuffer;)Ljava / util的/地图;
08-05 21:12:51.798:W / dalvikvm(1782):VFY:无法找到签名中引用的类(Lorg / apache / commons / collections / buffer / CircularFifoBuffer;)
08-05 21:12:51.798:V / Tagging(1782):启动WiFi模式
08-05 21:12:51.798:D / AndroidRuntime(1782):关闭虚拟机
08-05 21:12:51.806:W / dalvikvm(1782):threadid = 1:线程退出,未捕获异常(group = 0x4001d8a8)
08-05 21:12:51.806:E / AndroidRuntime(1782):致命异常:主
08-05 21:12:51.806:E / AndroidRuntime(1782):java.lang.NoClassDefFoundError:org.apache.commons.collections.buffer.CircularFifoBuffer
08-05 21:12:51.806:E / AndroidRuntime(1782):at com.jimmyc.summer.wificollection.WiFiLocationApp $ wifiMode。(WiFiLocationApp.java:182)
08-05 21:12:51.806:E / AndroidRuntime(1782):at com.jimmyc.summer.wificollection.WiFiLocationApp.onResume(WiFiLocationApp.java:1272)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.Activity.performResume(Activity.java:3823)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.os.Handler.dispatchMessage(Handler.java:99)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.os.Looper.loop(Looper.java:123)
08-05 21:12:51.806:E / AndroidRuntime(1782):在android.app.ActivityThread.main(ActivityThread.java:4627)
08-05 21:12:51.806:E / AndroidRuntime(1782):at java.lang.reflect.Method.invokeNative(Native Method)
08-05 21:12:51.806:E / AndroidRuntime(1782):at java.lang.reflect.Method.invoke(Method.java:521)
08-05 21:12:51.806:E / AndroidRuntime(1782):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)
08-05 21:12:51.806:E / AndroidRuntime(1782):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-05 21:12:51.806:E / AndroidRuntime(1782):at dalvik.system.NativeStart.main(Native Method)
08-05 21:12:51.814:W / ActivityManager(1291):强制完成活动com.jimmyc.summer.wificollection / .WiFiLocationApp
08-05 21:12:52.009:D / dalvikvm(1291):GC_FOR_MALLOC在76ms内释放了11331个对象/ 567768字节
08-05 21:12:52.314:W / ActivityManager(1291):HistoryRecord的活动暂停超时{457131f0 com.jimmyc.summer.wificollection / .WiFiLocationApp}
08-05 21:12:52.314:D /传感器(1291):使用MMA7660FC加速度计(名称= MMA7660FC加速度计)
08-05 21:12:52.321:D / Sensors(1291):get_orientation portait device
08-05 21:12:52.431:V / LocationManagerService(1291):_ requestLocationUpdates:listener = Receiver {45711848 Listener android.os.BinderProxy@45a461c8}
08-05 21:12:52.840:我// system / bin / batteryd(1189):1570480 v_bat 3.678(3.677),i_supply 0.500,i_demand 0.282 => v_bat_idle 3.649(3.649),等级41%(41%,41%),州5
public class test () {
CircularFifoBuffer f1 = null;
CircularFifoBuffer f2 = null;
public test () {
Log.v (TAG, "Starting...");
try {
f1 = new CircularFifoBuffer(4);
f2 = new CircularFifoBuffer(4);
} catch (Exception e) {
e.printStackTrace();
Log.v (TAG, "Error: " +e);
}
}
}
答案 0 :(得分:2)
检查库的jar依赖性。你可能会遗漏一些东西。 (令人怀疑的是,你说你已经在Android之外进行了测试)。
您可能需要从源代码构建才能使其工作,因为jar可以使用不同版本的Java构建(Android支持Java 6而不是7)。
答案 1 :(得分:2)
在logcat输出中,看起来这个类没有包含在你的apk中:
08-05 21:12:51.782: E/dalvikvm(1782): Could not find class 'org.apache.commons.collections.buffer.CircularFifoBuffer', referenced from method com.jimmyc.summer.wificollection.WiFiLocationApp$wifiMode.<init>
添加会说您最好的选择是获取源代码,将其包含在您的项目中并在构建环境中重新编译。