- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
经过测试,它可以在非 Android 程序上运行,但在 Android 上初始化后立即崩溃。 Log cat 也不产生任何错误消息。我从 CircularFifoBuffer 找到了这个.
有什么明显的问题吗?
编辑:如果我将 jar 文件添加到 libs 文件夹(不是外部文件夹),然后将其添加到构建路径,我确实会收到此错误消息。但是,如果我在外部添加 jar 文件,则不会出现此错误。
[2012-08-05 20:56:03 - wifiCollection] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.collections.SequencedHashMap$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is not an inner class.
编辑2:
08-05 21:12:48.837: I//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), level 41% (41%, 41%), state 5
08-05 21:12:50.837: I//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), level 41% (41%, 41%), state 5
08-05 21:12:51.267: I/ActivityManager(1291): Starting activity: Intent { 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: resizing JitTable from 4096 to 8192
08-05 21:12:51.353: I/ActivityManager(1291): Start 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 freed 1571 objects / 198264 bytes in 56ms
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): Application starting
08-05 21:12:51.774: V/Tagging(1782): Checking for wifi
08-05 21:12:51.774: V/Tagging(1782): Creating new wifiMode
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.
08-05 21:12:51.782: W/dalvikvm(1782): VFY: unable to resolve new-instance 575 (Lorg/apache/commons/collections/buffer/CircularFifoBuffer;) in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;
08-05 21:12:51.782: D/dalvikvm(1782): VFY: replacing opcode 0x22 at 0x0032
08-05 21:12:51.782: D/dalvikvm(1782): VFY: dead code 0x0034-0041 in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;. (Lcom/jimmyc/summer/wificollection/WiFiLocationApp;)V
08-05 21:12:51.790: I/dalvikvm(1782): Could not find method org.apache.commons.collections.buffer.CircularFifoBuffer.isFull, referenced from method com.jimmyc.summer.wificollection.WiFiLocationApp$wifiMode.detectStableEnvironment
08-05 21:12:51.790: W/dalvikvm(1782): VFY: unable to resolve virtual method 3504: Lorg/apache/commons/collections/buffer/CircularFifoBuffer;.isFull ()Z
08-05 21:12:51.790: D/dalvikvm(1782): VFY: replacing opcode 0x74 at 0x0006
08-05 21:12:51.790: D/dalvikvm(1782): VFY: dead code 0x0009-0230 in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;.detectStableEnvironment ()Z
08-05 21:12:51.790: I/dalvikvm(1782): Could not find method org.apache.commons.collections.buffer.CircularFifoBuffer.size, referenced from method com.jimmyc.summer.wificollection.WiFiLocationApp$wifiMode.match
08-05 21:12:51.790: W/dalvikvm(1782): VFY: unable to resolve virtual method 3506: Lorg/apache/commons/collections/buffer/CircularFifoBuffer;.size ()I
08-05 21:12:51.790: D/dalvikvm(1782): VFY: replacing opcode 0x74 at 0x000f
08-05 21:12:51.790: D/dalvikvm(1782): VFY: dead code 0x0012-0227 in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;.match ()Z
08-05 21:12:51.790: I/dalvikvm(1782): Could not find method org.apache.commons.collections.buffer.CircularFifoBuffer.add, referenced from method com.jimmyc.summer.wificollection.WiFiLocationApp$wifiMode.processResults
08-05 21:12:51.790: W/dalvikvm(1782): VFY: unable to resolve virtual method 3502: Lorg/apache/commons/collections/buffer/CircularFifoBuffer;.add (Ljava/lang/Object;)Z
08-05 21:12:51.790: D/dalvikvm(1782): VFY: replacing opcode 0x6e at 0x0020
08-05 21:12:51.790: D/dalvikvm(1782): VFY: dead code 0x0023-0050 in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;.processResults ()V
08-05 21:12:51.790: D/dalvikvm(1782): VFY: dead code 0x0074-00f0 in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;.processResults ()V
08-05 21:12:51.798: W/dalvikvm(1782): VFY: unable to find class referenced in signature (Lorg/apache/commons/collections/buffer/CircularFifoBuffer;)
08-05 21:12:51.798: I/dalvikvm(1782): Could not find method org.apache.commons.collections.buffer.CircularFifoBuffer.iterator, referenced from method com.jimmyc.summer.wificollection.WiFiLocationApp$wifiMode.takeAverage
08-05 21:12:51.798: W/dalvikvm(1782): VFY: unable to resolve virtual method 3505: Lorg/apache/commons/collections/buffer/CircularFifoBuffer;.iterator ()Ljava/util/Iterator;
08-05 21:12:51.798: D/dalvikvm(1782): VFY: replacing opcode 0x74 at 0x001b
08-05 21:12:51.798: D/dalvikvm(1782): VFY: dead code 0x001e-0419 in Lcom/jimmyc/summer/wificollection/WiFiLocationApp$wifiMode;.takeAverage (Lorg/apache/commons/collections/buffer/CircularFifoBuffer;)Ljava/util/Map;
08-05 21:12:51.798: W/dalvikvm(1782): VFY: unable to find class referenced in signature (Lorg/apache/commons/collections/buffer/CircularFifoBuffer;)
08-05 21:12:51.798: V/Tagging(1782): Starting WiFi mode
08-05 21:12:51.798: D/AndroidRuntime(1782): Shutting down VM
08-05 21:12:51.806: W/dalvikvm(1782): threadid=1: thread exiting with uncaught exception (group=0x4001d8a8)
08-05 21:12:51.806: E/AndroidRuntime(1782): FATAL EXCEPTION: main
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): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.app.Activity.performResume(Activity.java:3823)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.os.Handler.dispatchMessage(Handler.java:99)
08-05 21:12:51.806: E/AndroidRuntime(1782): at android.os.Looper.loop(Looper.java:123)
08-05 21:12:51.806: E/AndroidRuntime(1782): at 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): Force finishing activity com.jimmyc.summer.wificollection/.WiFiLocationApp
08-05 21:12:52.009: D/dalvikvm(1291): GC_FOR_MALLOC freed 11331 objects / 567768 bytes in 76ms
08-05 21:12:52.314: W/ActivityManager(1291): Activity pause timeout for HistoryRecord{457131f0 com.jimmyc.summer.wificollection/.WiFiLocationApp}
08-05 21:12:52.314: D/Sensors(1291): using MMA7660FC Accelerometer (name=MMA7660FC Accelerometer)
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: I//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), level 41% (41%, 41%), state 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);
}
}
}
最佳答案
从 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>
Add 会说你最好的选择是获取源代码,将其包含在你的项目中并在你的构建环境中重新编译它。
关于java - 在 Android 应用程序上初始化后 CircularFifoBuffer 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11821188/
背景 我正在尝试使用 Apache Commons 库中的 CircularFifoBuffer 类,该类包含通过 WebSocket 连接接收的最新消息的集合。但是,当我在 Linux 部署中达到
在apache common collections之间有什么区别: CircularFifoBuffer BoundedFifoBuffer 好的,第一个在满时删除最旧的条目,另一个以与进来的顺序相
经过测试,它可以在非 Android 程序上运行,但在 Android 上初始化后立即崩溃。 Log cat 也不产生任何错误消息。我从 CircularFifoBuffer 找到了这个. 有什么明显
我需要一种数据结构,能够以 FIFO 顺序有效地缓冲特定数量的元素。 如 this question 中所述,Apache Commons 有一个 CircularFifoBuffer,但遗憾的是它没
我是一名优秀的程序员,十分优秀!