1
我嘗試用jni在c中構建java對象。並且使用一些代碼象下面這樣:Android jni GetMethID崩潰
jmethodID method_cls_video_info_set_duration = (*env)->GetMethodID(env, cls_video_info, "setDuration", "(J)V");
LOGD("4");
jmethodID method_cls_video_info_set_audio_codec = (*env)->GetMethodID(env, cls_video_info, "setAudioCodec", "(Ljava/long/String;)V");
LOGD("11");
jmethodID method_cls_video_info_set_video_codec = (*env)->GetMethodID(env, cls_video_info, "setVideoCodec", "(Ljava/long/String;)V");
LOGD("9");
但是,我得到了一個崩潰的位置:
jmethodID method_cls_video_info_set_video_codec = (*env)->GetMethodID(env, cls_video_info, "setVideoCodec", "(Ljava/long/String;)V");
和日誌是這樣的:
Build fingerprint: 'HONOR/PLK-UL00/HWPLK:6.0/HONORPLK-UL00/C17B352:user/release-keys'
pid: 4664, tid: 4728, name: ationTestRunner >>> com.y <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame #00 pc 00042e4c /system/lib/libc.so (tgkill+12)
Stack frame #01 pc 00041e35 /system/lib/libc.so (pthread_kill+32)
Stack frame #02 pc 0001bb53 /system/lib/libc.so (raise+10)
Stack frame #03 pc 00018db1 /system/lib/libc.so (__libc_android_abort+34)
Stack frame #04 pc 0001696c /system/lib/libc.so (abort+4)
Stack frame #05 pc 003320e1 /system/lib/libart.so (art::Runtime::Abort()+232)
Stack frame #06 pc 000f4e1b /system/lib/libart.so (art::LogMessage::~LogMessage()+2226)
Stack frame #07 pc 0025ac17 /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1550)
Stack frame #08 pc 0025afc5 /system/lib/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+64)
Stack frame #09 pc 000fda29 /system/lib/libart.so (art::ScopedCheck::AbortF(char const*, ...)+32)
Stack frame #10 pc 00102b3d /system/lib/libart.so (art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) (.constprop.95)+5072)
Stack frame #11 pc 00113785 /system/lib/libart.so (art::CheckJNI::GetMethodID(_JNIEnv*, _jclass*, char const*, char const*)+396)
Stack frame #12 pc 00009843 /data/app/com.y-1/lib/arm/libffmpeg-jni.so (Java_com_y_ffmpeglib_FFmpegJNI_getVideoInfo+498): Routine get_format at /mnt/bin/ASWorkspace/YoEventV/ffmpeglibrary/jni/ffmpeg_mod.c:2395
你能共享Java類? –