Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNI EXCEPTION : NoSuchMethodError: no static method "Lorg/bytedeco/javacpp/Loader;.putMemberOffset(Ljava/lang/String;Ljava/lang/String;I)V" #556

Closed
ArjunAchatz-MF opened this issue Nov 11, 2016 · 3 comments
Labels

Comments

@ArjunAchatz-MF
Copy link

ArjunAchatz-MF commented Nov 11, 2016

Hi,

I recently tried to publish my app on google play, it was rejected because of the openssl version contained in ffmpeg .so's. So to get around this I am attempting to upgrade javacv from version 1.1 to 1.2.

These are the follow steps i've taken:

  1. Downloaded the javacpp-presets (opencv/ffmpeg for both arm/x86) from http://search.maven.org/#search%7Cga%7C1%7Cbytedeco . I know I have the latests versions opencv .so date to may, ffmpeg .so's date to august.

  2. Extracted the .so's via "jar xf ...."

  3. Placed the .so's into appropriate jni/libs/xx folders

  4. Include the following

packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
}

configurations {
all*.exclude group: 'org.bytedeco', module: 'javacpp-presets'
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':openCVLibrary310')

compile group: 'org.bytedeco', name: 'javacv', version: '1.2'
compile group: 'org.bytedeco', name: 'javacpp', version: '1.2.4'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.2', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.2', classifier: 'android-x86'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.1.2-1.2', classifier: 'android-arm'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.1.2-1.2', classifier: 'android-x86'
  1. inside android.mk I've also included all (59) .so's as static libraries, that I extracted from opencv & ffmpeg; so these static libraries are definately being included

  2. Gradle compiles fine .. but runtime error occurs on trying to use FFMPEGFrameGrabber.

I'm not sure what I am doing wrong. My target sdk is 23 and this whole approach works with javacv 1.1. I opened up this as a new issue in hopes to try and be as detailed as possible with the newest versions so others may follow. That and I've been stuck for two days !

I've pasted my error below:

11-11 12:33:29.311 10969-12039/my.package.name E/javacpp: Error getting static method ID of org/bytedeco/javacpp/Loader/putMemberOffset
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.NoSuchMethodError: no static method "Lorg/bytedeco/javacpp/Loader;.putMemberOffset(Ljava/lang/String;Ljava/lang/String;I)V"
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String) (Runtime.java:-2)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String java.lang.Runtime.doLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:435)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void java.lang.Runtime.loadLibrary(java.lang.String, java.lang.ClassLoader) (Runtime.java:370)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void java.lang.System.loadLibrary(java.lang.String) (System.java:1076)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String org.bytedeco.javacpp.Loader.loadLibrary(java.net.URL[], java.lang.String) (Loader.java:702)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String org.bytedeco.javacpp.Loader.load(java.lang.Class, java.util.Properties, boolean) (Loader.java:500)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String org.bytedeco.javacpp.Loader.load() (Loader.java:417)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void org.bytedeco.javacpp.avutil.() (avutil.java:10)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Class java.lang.Class.classForName!(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:324)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String org.bytedeco.javacpp.Loader.load(java.lang.Class, java.util.Properties, boolean) (Loader.java:472)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.String org.bytedeco.javacpp.Loader.load(java.lang.Class) (Loader.java:433)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void org.bytedeco.javacv.FFmpegFrameGrabber.tryLoad() (FFmpegFrameGrabber.java:88)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void org.bytedeco.javacv.FFmpegFrameGrabber.() (FFmpegFrameGrabber.java:113)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void my.package.name.UI.OrbSlamProcessing.generatePointCloud() (OrbSlamProcessing.java:129)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void my.package.name.UI.OrbSlamProcessing.access$000(my.package.name.UI.OrbSlamProcessing) (OrbSlamProcessing.java:51)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void my.package.name.UI.OrbSlamProcessing$1.run() (OrbSlamProcessing.java:98)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at void java.lang.Thread.run() (Thread.java:818)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410]
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] in call to NewGlobalRef
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.String)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] "Thread-1156" prio=5 tid=20 Runnable
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x12e80d60 self=0xd77e0100
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] | sysTid=12039 nice=0 cgrp=default sched=0/0 handle=0xd10e9930
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 0 0 0 ) utm=1515 stm=25 core=6 HZ=100
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] | stack=0xd0fe7000-0xd0fe9000 stackSize=1038KB
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] | held mutexes= "mutator lock"(shared held)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #00 pc 00371bd7 /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+142)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #1 pc 00351199 /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+160)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #2 pc 0025b30b /system/lib/libart.so (ZN3art9JavaVMExt8JniAbortEPKcS2+742)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #3 pc 0025b9e5 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #4 pc 000fd391 /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #5 pc 001024a5 /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5072)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #6 pc 00114891 /system/lib/libart.so (_ZN3art8CheckJNI12NewGlobalRefEP7_JNIEnvP8_jobject+392)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #7 pc 00349dc3 /system/lib/libart.so (_ZN3art6Thread22SetClassLoaderOverrideEP8_jobject+38)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #8 pc 0025bfa3 /system/lib/libart.so (ZN3art9JavaVMExt17LoadNativeLibraryEP7_JNIEnvRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEP8_jobjectPS9+1290)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #9 pc 002d1fc7 /system/lib/libart.so (ZN3artL18Runtime_nativeLoadEP7_JNIEnvP7_jclassP8_jstringP8_jobjectS5+194)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] native: #10 pc 0317651d /system/framework/arm/boot.oat (Java_java_lang_Runtime_nativeLoad__Ljava_lang_String_2Ljava_lang_ClassLoader_2Ljava_lang_String_2+144)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Runtime.nativeLoad(Native method)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Runtime.doLoad(Runtime.java:435)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] - locked <0x0f2821bb> (a java.lang.Runtime)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Runtime.loadLibrary(Runtime.java:370)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.System.loadLibrary(System.java:1076)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:702)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacpp.Loader.load(Loader.java:500)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacpp.Loader.load(Loader.java:417)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacpp.avutil.(avutil.java:10)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Class.classForName!(Native method)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Class.forName(Class.java:324)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacpp.Loader.load(Loader.java:472)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacpp.Loader.load(Loader.java:433)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacv.FFmpegFrameGrabber.tryLoad(FFmpegFrameGrabber.java:88)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at org.bytedeco.javacv.FFmpegFrameGrabber.(FFmpegFrameGrabber.java:113)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at my.package.name.UI.OrbSlamProcessing.generatePointCloud(OrbSlamProcessing.java:129)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at my.package.name.UI.OrbSlamProcessing.access$000(OrbSlamProcessing.java:51)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at my.package.name.UI.OrbSlamProcessing$1.run(OrbSlamProcessing.java:98)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Thread.run(Thread.java:818)
11-11 12:33:29.331 10969-12039/my.package.name A/art: art/runtime/java_vm_ext.cc:410]

@saudet
Copy link
Member

saudet commented Nov 12, 2016

Looks like you forgot to add the Java artifacts for OpenCV and FFmpeg:

compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.1.0-1.2'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.1.2-1.2'

@Maherbassi
Copy link

Same problem with me, any solution please!

@saudet
Copy link
Member

saudet commented May 9, 2020

That indicates a version conflict. Make sure to use the same version of everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants