1. 程式人生 > >【呼叫javacv進行人臉識別 總是出現 無法找到 java.util.Arrays.copyOf】

【呼叫javacv進行人臉識別 總是出現 無法找到 java.util.Arrays.copyOf】

呼叫javacv進行人臉識別,總是出現錯誤:
I/dalvikvm(1537): Could not find method java.util.Arrays.copyOf, referenced from method com.googlecode.javacpp.Loader.findLibrary
W/dalvikvm(1537): VFY: unable to resolve static method 21064: Ljava/util/Arrays;.copyOf ([Ljava/lang/Object;I)[Ljava/lang/Object;
D/dalvikvm(1537): VFY: replacing opcode 0x71 at 0x01bd
D/dalvikvm(1537): VFY: dead code 0x01c0-01c4 in Lcom/googlecode/javacpp/Loader;.findLibrary (Ljava/lang/Class;Lcom/googlecode/javacpp/Loader$ClassProperties;Ljava/lang/String;)[Ljava/net/URL;
I/dalvikvm(1537): Could not find method java.util.Properties.load, referenced from method com.googlecode.javacpp.Loader.loadProperties
W/dalvikvm(1537): VFY: unable to resolve virtual method 21145: Ljava/util/Properties;.load (Ljava/io/Reader;)V
D/dalvikvm(1537): VFY: replacing opcode 0x6e at 0x002e
I/dalvikvm(1537): Could not find method java.util.Properties.load, referenced from method com.googlecode.javacpp.Loader.loadProperties
W/dalvikvm(1537): VFY: unable to resolve virtual method 21145: Ljava/util/Properties;.load (Ljava/io/Reader;)V
D/dalvikvm(1537): VFY: replacing opcode 0x6e at 0x0045
D/dalvikvm(1537): VFY: dead code 0x0048-0048 in Lcom/googlecode/javacpp/Loader;.loadProperties (Ljava/lang/String;)Ljava/util/Properties;
D/dalvikvm(1537): GC_FOR_MALLOC freed 5490 objects / 446584 bytes in 92ms
W/dalvikvm(1537): Exception Ljava/lang/NoSuchMethodError; thrown during Lcom/googlecode/javacv/cpp/avformat;.<clinit>

查詢後發現,javaCPP0.7 相對於0.6做出如下改變:

JavaCPP 0.7 - Changelog

http://mac.softpedia.com/progChangelog/JavaCPP-Changelog-117206.html
January 10th, 2014
  • Tweaked a few things to support RoboVM and target iOS, but `JNI_OnLoad()` does not appear to get called...
  • Upgraded references of the Android NDK to version r9c
  • Made `Loader.load()` work, within reason, even when all annotations and resources have been removed, for example, by ProGuard
  • Fixed compile error when using a `FunctionPointer` as parameter from outside its top-level enclosing class
  • Added new `Pointer.deallocate(false)` call to disable garbage collection on a per object basis, allowing users to deal with memory leaks in other ways
  • Changed the default compiler option `-mfpu=vfpv` for ARM to `-mfpu=vfpv3-d16`, because the former is not supported by Tegra 2
  • Removed call to `Arrays.copyOf()` in `Loader.findLibrary()`, which would prevent it from working on Android 2.2 (issue #39)
  • Fixed invalid code generated for `FunctionPointer` parameters annotated with `@Const @ByRef`
  • Fixed `NullPointerException` in `Loader.load()` when no `@Platform` annotation is provided (issue #38)
  • Parsing for anonymous `struct` or `union` and for `typedef void` (mapped to `@Opaque Pointer`) now outputs something
  • The `Parser` now expands preprocessor macros, filters tokens appropriately, and outputs all unprocessed directives as comments
  • Improved the C++ support of the `Parser` for namespaces, derived classes, access specifiers, custom constructors, vector types, macros, templates, overloaded operators, etc
  • Fixed `typedef` of function pointers and a few code formatting issues with `Parser`
  • Supplied checks to prevent `Loader.load()` from throwing `java.lang.IllegalStateException: Can't overwrite cause
按道理我將javaCPP0.6更換為0.7後不應出錯,但還是出現相同的問題,尚未結局,糾結中