- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从native-lib.cpp类callback()方法创建一个回调来在Java中调用某些方法。但是为此,我还需要env变量。我试图在native-lib.cpp中创建相同的文件,但出现此错误。我认为由于线程被释放而出现了一些问题。有人可以澄清一下吗?我对回调创建概念非常陌生。有人可以确切指出问题所在。在我看来,detachThread存在一些问题。有人可以澄清这个问题吗?提前致谢。
这是native-lib.cpp:
#include <jni.h>
#include <string>
#include "Numbers.h"
#include <android/log.h>
#define LOG_TAG "logs"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
typedef struct number_ctx{
JavaVM *javaVM;
jclass mathsClass;
jobject mathsObj;
jclass mainActivityClass;
jobject mainActivityObj;
pthread_mutex_t lock;
} NumbersCtx;
NumbersCtx g_ctx;
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEnv* env;
memset(&g_ctx, 0, sizeof(g_ctx));
g_ctx.javaVM = vm;
if (vm ->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) {
return JNI_ERR; // JNI version not supported.
}
jclass clz = env->FindClass(
"com/example/maths/Maths1");
g_ctx.mathsClass = static_cast<jclass>(env->NewGlobalRef(clz));
clz = env->FindClass(
"com/example/maths/MainActivity");
g_ctx.mainActivityClass = static_cast<jclass>(env->NewGlobalRef(clz));
g_ctx.mathsObj = NULL;
g_ctx.mainActivityObj = NULL;
env->DeleteLocalRef(clz);
return JNI_VERSION_1_6;
}
void callback() {
JNIEnv* env;
LOGD("Starting finally ");
if (g_ctx.javaVM ->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) {
LOGD("JNI Error is %d" , JNI_ERR); // JNI version not supported.
}
LOGD("Env variable received successfully");
int status = g_ctx.javaVM->AttachCurrentThread(&env, NULL);
if(status != JNI_OK) {
LOGD("Failed to attach the thread");
} else {
LOGD("Thread attached successfully");
jmethodID testMessage = env->GetMethodID(g_ctx.mathsClass, "printMessage",
"()V");
// Call the method on the object
env->CallVoidMethod(g_ctx.mathsObj, testMessage);
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
}
LOGD("Void Method called Successfully");
g_ctx.javaVM->DetachCurrentThread();
LOGD("Thread detached successfully");
}
LOGD("This callback is called finally");
}
jfieldID getPtrFieldId(JNIEnv * env, jobject obj)
{
static jfieldID ptrFieldId = 0;
if (!ptrFieldId)
{
jclass c = env->GetObjectClass(obj);
ptrFieldId = env->GetFieldID(c, "numberptr", "J");
env->DeleteLocalRef(c);
}
return ptrFieldId;
}
extern "C"
JNIEXPORT void JNICALL
Java_com_example_maths_Maths1_createNumberInstance(JNIEnv *env, jobject thiz, jint a, jint b) {
// TODO: implement createNumberInstance()
g_ctx.mathsObj = env->NewGlobalRef(thiz);
Numbers* num = new Numbers(a, b);
callback();
env->SetLongField(thiz, getPtrFieldId(env, thiz), (jlong) num);
}
2020-06-02 19:25:39.101 15965-15965/com.example.maths A/m.example.math: runtime.cc:2067] Thread[1,tid=15965,Native,Thread*=0xec991800,peer=0x71b391f0,"main"] attempting to detach while still running code
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] Runtime aborting...
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] Dumping all threads without mutator lock held
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] All threads:
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] DALVIK THREADS (17):
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] "main" prio=10 tid=1 Runnable
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | group="" sCount=0 dsCount=0 flags=0 obj=0x71b391f0 self=0xec991800
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | sysTid=15965 nice=-10 cgrp=default sched=0/0 handle=0xece36dc8
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | state=R schedstat=( 466154407 353144186 350 ) utm=12 stm=34 core=0 HZ=100
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | stack=0xff27a000-0xff27c000 stackSize=8192KB
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | held mutexes= "abort lock" "mutator lock"(shared held)
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #00 pc 00493b43 /apex/com.android.runtime/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+115)
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #01 pc 005b1fd2 /apex/com.android.runtime/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool, BacktraceMap*, bool) const+994)
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #02 pc 005ace61 /apex/com.android.runtime/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool, BacktraceMap*, bool) const+65)
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #03 pc 005d2cd1 /apex/com.android.runtime/lib/libart.so (art::DumpCheckpoint::Run(art::Thread*)+929)
2020-06-02 19:25:39.497 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #04 pc 005cac06 /apex/com.android.runtime/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+486)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #05 pc 005c9e6c /apex/com.android.runtime/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool)+2268)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #06 pc 005796f0 /apex/com.android.runtime/lib/libart.so (art::AbortState::DumpAllThreads(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, art::Thread*) const+448)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #07 pc 00564d30 /apex/com.android.runtime/lib/libart.so (art::Runtime::Abort(char const*)+1536)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #08 pc 000249b3 /apex/com.android.runtime/lib/libartbase.so (_ZNSt3__110__function6__funcIPFvPKcENS_9allocatorIS5_EES4_EclEOS3_+35)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #09 pc 0000bac7 /system/lib/libbase.so (android::base::LogMessage::~LogMessage()+727)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #10 pc 005645de /apex/com.android.runtime/lib/libart.so (art::Runtime::DetachCurrentThread()+414)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #11 pc 003ecc83 /apex/com.android.runtime/lib/libart.so (art::JII::DetachCurrentThread(_JavaVM*)+67)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #12 pc 003e3445 /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::CheckJII::DetachCurrentThread(_JavaVM*)+117)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #13 pc 00009d6a /data/app/com.example.maths-alZFaEzd-BAd84VC19Fvrg==/lib/x86/libnative-lib.so (_JavaVM::DetachCurrentThread()+42)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #14 pc 00009a8a /data/app/com.example.maths-alZFaEzd-BAd84VC19Fvrg==/lib/x86/libnative-lib.so (callback()+554)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #15 pc 0000a24c /data/app/com.example.maths-alZFaEzd-BAd84VC19Fvrg==/lib/x86/libnative-lib.so (Java_com_example_maths_Maths1_createNumberInstance+172)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #16 pc 00144f67 /apex/com.android.runtime/lib/libart.so (art_quick_generic_jni_trampoline+71)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #17 pc 0013e7d2 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+338)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #18 pc 00149a69 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+281)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #19 pc 00332502 /apex/com.android.runtime/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+386)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #20 pc 0032c19c /apex/com.android.runtime/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+988)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #21 pc 006818dd /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+989)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #22 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #23 pc 0011dc02 [anon:dalvik-classes.dex extracted in memory from /data/app/com.example.maths-alZFaEzd-BAd84VC19Fvrg==/base.apk] (com.example.maths.Maths1.<init>+26)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #24 pc 0068461c /apex/com.android.runtime/lib/libart.so (MterpInvokeDirect+1324)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #25 pc 00138921 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_direct+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #26 pc 0011db02 [anon:dalvik-classes.dex extracted in memory from /data/app/com.example.maths-alZFaEzd-BAd84VC19Fvrg==/base.apk] (com.example.maths.MainActivity.onCreate+26)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #27 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #28 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #29 pc 0019175e /system/framework/framework.jar (android.app.Activity.performCreate+30)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #30 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #31 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #32 pc 00191726 /system/framework/framework.jar (android.app.Activity.performCreate+2)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #33 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #34 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #35 pc 001eefda /system/framework/framework.jar (android.app.Instrumentation.callActivityOnCreate+6)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #36 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #37 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #38 pc 00180bb8 /system/framework/framework.jar (android.app.ActivityThread.performLaunchActivity+752)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #39 pc 0068461c /apex/com.android.runtime/lib/libart.so (MterpInvokeDirect+1324)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #40 pc 00138921 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_direct+33)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #41 pc 00180836 /system/framework/framework.jar (android.app.ActivityThread.handleLaunchActivity+94)
2020-06-02 19:25:39.498 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #42 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #43 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #44 pc 0025e28e /system/framework/framework.jar (android.app.servertransaction.LaunchActivityItem.execute+126)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #45 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #46 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #47 pc 002607da /system/framework/framework.jar (android.app.servertransaction.TransactionExecutor.executeCallbacks+154)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #48 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #49 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #50 pc 00260716 /system/framework/framework.jar (android.app.servertransaction.TransactionExecutor.execute+146)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #51 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #52 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #53 pc 0017fb6e /system/framework/framework.jar (android.app.ActivityThread$H.handleMessage+78)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #54 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #55 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #56 pc 002f5846 /system/framework/framework.jar (android.os.Handler.dispatchMessage+38)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #57 pc 00681b4c /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtual+1612)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #58 pc 00138821 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #59 pc 00319ee6 /system/framework/framework.jar (android.os.Looper.loop+466)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #60 pc 00684fdc /apex/com.android.runtime/lib/libart.so (MterpInvokeStatic+1260)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #61 pc 001389a1 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_static+33)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #62 pc 00189466 /system/framework/framework.jar (android.app.ActivityThread.main+194)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #63 pc 002f8e0a /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.1175793267244191248+298)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #64 pc 002ffcc5 /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+181)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #65 pc 0066fc49 /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+1209)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #66 pc 0014503d /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+77)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #67 pc 0013e9a2 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_static_stub+418)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #68 pc 00149a7a /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+298)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #69 pc 0055a563 /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+99)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #70 pc 0055c37f /apex/com.android.runtime/lib/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned int)+1327)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #71 pc 004c91a3 /apex/com.android.runtime/lib/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+83)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] at com.example.maths.Maths1.createNumberInstance(Native method)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] at com.example.maths.Maths1.<init>(Maths1.java:16)
2020-06-02 19:25:39.499 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] at com.example.maths.MainActivity.onCreate(MainActivity.java:21)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630]
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] "Runtime worker thread 0" prio=10 tid=2 Native (still starting up)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | group="" sCount=1 dsCount=0 flags=1 obj=0x0 self=0xd9500000
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | sysTid=15991 nice=0 cgrp=default sched=0/0 handle=0xec77fd90
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | state=S schedstat=( 1604515 798906 8 ) utm=0 stm=0 core=1 HZ=100
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | stack=0xec771000-0xec773000 stackSize=63KB
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | held mutexes=
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] kernel: (couldn't read /proc/self/task/15991/stack)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #00 pc 00000b77 [vdso] (__kernel_vsyscall+7)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #01 pc 00092328 /apex/com.android.runtime/lib/bionic/libc.so (syscall+40)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #02 pc 00150802 /apex/com.android.runtime/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+114)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #03 pc 00150783 /apex/com.android.runtime/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+35)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #04 pc 005d4b15 /apex/com.android.runtime/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+261)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #05 pc 005d3c43 /apex/com.android.runtime/lib/libart.so (art::ThreadPoolWorker::Run()+83)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #06 pc 005d370f /apex/com.android.runtime/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+239)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #07 pc 0011a8e5 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+53)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #08 pc 000af6a7 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] (no managed stack frames)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630]
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] "Jit thread pool worker thread 0" prio=10 tid=3 Native
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | group="" sCount=1 dsCount=0 flags=1 obj=0x159c0030 self=0xec98ee00
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | sysTid=15990 nice=0 cgrp=default sched=0/0 handle=0xd9404d90
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | state=S schedstat=( 4160010 1789692 15 ) utm=0 stm=0 core=1 HZ=100
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | stack=0xd9306000-0xd9308000 stackSize=1023KB
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | held mutexes=
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] kernel: (couldn't read /proc/self/task/15990/stack)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #00 pc 00000b77 [vdso] (__kernel_vsyscall+7)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #01 pc 00092328 /apex/com.android.runtime/lib/bionic/libc.so (syscall+40)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #02 pc 00150802 /apex/com.android.runtime/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+114)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #03 pc 00150783 /apex/com.android.runtime/lib/libart.so (art::ConditionVariable::Wait(art::Thread*)+35)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #04 pc 005d4b15 /apex/com.android.runtime/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+261)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #05 pc 005d3c75 /apex/com.android.runtime/lib/libart.so (art::ThreadPoolWorker::Run()+133)
2020-06-02 19:25:39.500 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #06 pc 005d370f /apex/com.android.runtime/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+239)
2020-06-02 19:25:39.501 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #07 pc 0011a8e5 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+53)
2020-06-02 19:25:39.501 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] native: #08 pc 000af6a7 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+71)
2020-06-02 19:25:39.501 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] (no managed stack frames)
2020-06-02 19:25:39.501 15965-15965/com.example.maths A/m.example.math: runtime.cc:630]
2020-06-02 19:25:39.501 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] "Runtime worker thread 1" prio=10 tid=4 Native (still starting up)
2020-06-02 19:25:39.501 15965-15965/com.example.maths A/m.example.math: runtime.cc:630] | group="" sCount=1 dsCount=0 flags=1 obj=0x0 self=0xd9508c00
最佳答案
如果GetEnv
返回JNI_OK
,则当前线程已附加,因此您不应该尝试将其分离为。
这就是Android向您大喊血腥谋杀的原因:您正试图分离主线程!
如果返回JNI_EDETACHED
,则应该尝试附加(并在以后分离)。
关于android - 调用callback()到Java时应用崩溃。由于detatchThread而导致运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62154141/
我有一段代码看起来像这样: void update_clock(uint8_t *time_array) { time_t time = *((time_t *) &time_array[0]
应用程序崩溃了 :( 请帮助我.. 在这方面失败了。我找不到错误?该应用程序可以连接到 iTunesConnect 但它会出错。 谁能根据下面的崩溃报告判断问题出在哪里? share_with_app
小二是新来的实习生,作为技术 leader,我给他安排了一个非常简单的练手任务,把前端 markdown 编辑器里上传的图片保存到服务器端,结果他真的就把图片直接保存到了服务器上,这下可把我气坏了,就
我正在创建一个函数,它将目录路径作为参数传递,或者如果它留空,则提示用户输入。 我已经设置了我的 PATH_MAX=100 和 if 语句来检查 if ((strlen(folder path) +
我已将“arial.ttf”文件(从我的/Windows/Fonts 文件夹中获取)加载到内存中,但是将其传递到 FT_New_Memory_Face 时会崩溃(在 FT_Open_Face 中的某处
我正在尝试在我的计算机上的两个控制台之间进行 rtsp 流。 在控制台 1 上,我有: ffmpeg -rtbufsize 100M -re -f dshow -s 320x240 -i video=
我正在尝试使用 scio_beast在一个项目中。我知道它还没有完成,但这并不重要。我已经设法让它工作得很好。 我现在正在尝试连接到 CloudFlare 后面的服务器,我知道我需要 SNI 才能工作
我有一个带有关联宏的下拉列表,如下所示: Sub Drop() If Range("Hidden1!A1") = "1" Then Sheets("Sheet1").Se
我对 bash 很陌生。我要做的就是运行这个nvvp -vm /usr/lib64/jvm/jre-1.8.0/bin/java无需记住最后的路径。我认为 instafix 就是这样做...... n
我在 Windows 上使用 XAMPP 已经两年左右了,它运行完美,没有崩溃没有问题。 (直到四个月前。) 大约四个月前,我们将服务器/系统升级到了更快的规范。 这是旧规范的内容 - Windows
我面临着一个非常烦人的 android 崩溃,它发生在大约 1% 的 PRODUCTION session 中,应用程序始终在后台运行。 Fatal Exception: android.app.Re
尝试使用下面的函数: public void createObjectType() { try { mCloudDB.createObjectType(ObjectTypeIn
由于我正在进行的一个项目,我在 CF11 管理员中弄乱了类路径,我设法使服务器崩溃,以至于我唯一得到的是一个漂亮的蓝屏和 500 错误.我已经检查了日志,我会把我能做的贴在帖子的底部,但我希望有人会启
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 10 个月前关闭。 Improve
我最近从 xcode 3.x 更新到 4.2,当我在 4.2 中运行应用程序时,我遇到了核心数据问题。我还更新到了 iOS 5,所以问题可能就在那里,我不太确定。 这些应用程序在 3.x 中运行良好,
我是一个相对较新的 iPhone 应用程序开发人员,所以我的知识有点粗略,所以如果这是一个微不足道的问题,请原谅我。 我有一个导航应用程序,它通过在navigationController对象上调用p
if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailViewController
你能帮我吗? 我正在设置 UILocalNotification,当我尝试设置其 userInfo 字典时,它崩溃了。 fetchedObjects 包含 88 个对象。 这是代码: NSDi
为什么我的代码中突然出现 NSFastEnumeration Mutation Handler 崩溃。我很茫然为什么会突然出现这个崩溃以及如何解决它。 最佳答案 崩溃错误: **** 由于未捕获的异常
当我从表中删除行时,我的应用程序崩溃了。这是我检测到错误和堆栈跟踪的来源。谢谢! //delete row from database - (void)tableView:(UITableView *
我是一名优秀的程序员,十分优秀!