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 DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception #123

Closed
developerzhu opened this issue Apr 27, 2016 · 7 comments

Comments

@developerzhu
Copy link

My app used Baidu Map SDK, and I init it in my Customer Application:

onCreate(){
……
SDKInitializer.initialize(getApplicationContext());
……
}

and before redex, my app run fine, but after redex an resign, it crash after install and run.
Here is the error log:

JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.NoSuchMethodError: no static method "Lcom/baidu/platform/comjni/engine/AppEngine;.despatchMessage(IIIJ)V"
at int com.baidu.platform.comjni.engine.JNIEngine.initClass(java.lang.Object, int) ((null):-2)
at void com.baidu.platform.comjni.engine.AppEngine.InitClass() ((null):-1)
at void com.baidu.platform.comapi.a.() ((null):-1)
at void com.baidu.platform.comapi.c.a(java.lang.String, android.content.Context) ((null):-1)

@bertmaher
Copy link
Contributor

Most likely redex is removing that method because it's not aware that it's called via JNI. Can you create a config file (docs/Config.md explains how to use one) that contains:

{
  "reflected_packages" : [ "Lcom/baidu/platform/comjni/engine/" ],
  "keep_packages" : ["Lcom/baidu/platform/comjni/engine/"]
}

and see if we get past that error? Thanks!

@developerzhu
Copy link
Author

It doesn,t work!
After redex, when I install the apk, it failed, telling me "There was a problem parsing the package".

@kingty
Copy link

kingty commented May 5, 2016

@bertmaher same problem

@Phil-Coulson
Copy link

Phil-Coulson commented May 21, 2016

@bertmaher
same problem and after I add the code you provide:

{
"redex" : {
"passes" : [
"ReBindRefsPass",
"BridgePass",
"SynthPass",
"FinalInlinePass",
"DelSuperPass",
"SingleImplPass",
"SimpleInlinePass",
"StaticReloPass",
"RemoveEmptyClassesPass",
"ShortenSrcStringsPass"
],
"reflected_packages" : [ "Lcom/baidu/platform/comjni/engine/" ],
"keep_packages" : ["Lcom/baidu/platform/comjni/engine/"]
}
}

And I redex my apk successfully, but when I install my apk, I found the error during installing like this:

W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.tencent.assistant.protocol.jce.AppSimpleDetail.toString()' on a null object reference
at com.tencent.pangu.manager.cj.onGetAppInfoSuccess(ProGuard:315)
at com.tencent.assistant.module.az.a(ProGuard:71)
at com.tencent.assistant.module.az.call(ProGuard:66)
at com.tencent.assistant.module.callback.CallbackHelper.broadcast(ProGuard:102)
at com.tencent.assistant.module.BaseEngine.notifyDataChanged(ProGuard:66)
at com.tencent.assistant.module.m.run(ProGuard:41)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/SQLiteLog: (1) table local_appinfo has no column named filelistmd5
E/SQLiteDatabase: Error inserting packagename=com.test fakeLastLaunchTime=1463822468227 flags=15253062 appname=xxxxxx signature=1F6B42EE9C49C331AEB8BE7DED58E2E1 installtime=1463822447000 installeLocation=1 filelistmd5=86587ab9497200b71a7cd35bd8ff86a6 batteryUsage=0 versioncode=1000 lastLaunchTime=1463822468227 launchCount=0 versionname=x.x.0 filepath=/data/app/com.test-1/base.apk iconRes=2130903040 manifest_md5=74841F57154D854E08B928E601FCF66A sortkey=xxxxxxx dataUsage=0 appsize=0 installed=1 grayVersionCode=0 uid=0
android.database.sqlite.SQLiteException: table local_appinfo has no column named filelistmd5 (code 1): , while compiling: INSERT INTO local_appinfo(packagename,fakeLastLaunchTime,flags,appname,signature,installtime,installeLocation,filelistmd5,batteryUsage,versioncode,lastLaunchTime,launchCount,versionname,filepath,iconRes,manifest_md5,sortkey,dataUsage,appsize,installed,grayVersionCode,uid) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469)
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1341)
at com.tencent.assistant.db.helper.SQLiteDatabaseWrapper.insert(ProGuard:42)
at com.tencent.pangu.a.a.g.a(ProGuard:152)
at com.tencent.assistant.localres.g.run(ProGuard:749)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

My apk was installed, But when I try to run it, it crash.Here is the error log:

E/MediaPlayer: Should have subtitle controller already set
A/art: art/runtime/verifier/method_verifier.cc:3321] Check failed: !Thread::Current()->IsExceptionPending()
A/art: art/runtime/verifier/method_verifier.cc:3321] Check failed: !Thread::Current()->IsExceptionPending()
A/art: art/runtime/runtime.cc:284] Runtime aborting --- recursively, so no thread-specific detail!
A/art: art/runtime/runtime.cc:284]
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 11196 (ster.app)
W/debuggerd_real: type=1400 audit(0.0:6037): avc: denied { ptrace } for scontext=u:r:init:s0 tcontext=u:r:untrusted_app:s0 tclass=process
W/debuggerd_real: type=1400 audit(0.0:6038): avc: denied { sigstop } for scontext=u:r:init:s0 tcontext=u:r:untrusted_app:s0 tclass=process
I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** * * * ***
I/DEBUG: Build fingerprint: 'google/hammerhead/hammerhead:5.0.1/LRX22C/1602158:user/release-keys'
I/DEBUG: Revision: '11'
I/DEBUG: ABI: 'arm'
I/DEBUG: pid: 11196, tid: 11196, name: ster.app >>> com.coulson.phil.master.app <<<
I/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG: Abort message: 'art/runtime/verifier/method_verifier.cc:3321] Check failed: !Thread::Current()->IsExceptionPending() '
I/DEBUG: r0 00000000 r1 00002bbc r2 00000006 r3 00000000
I/DEBUG: r4 b6f2f114 r5 00000006 r6 00000002 r7 0000010c
I/DEBUG: r8 00000001 r9 b504f520 sl b5007800 fp af262f00
I/DEBUG: ip 00002bbc sp be835888 lr b6eb9af9 pc b6edcc24 cpsr 60070010
I/DEBUG: backtrace:
I/DEBUG: #00 pc 00039c24 /system/lib/libc.so (tgkill+12)
I/DEBUG: #1 pc 00016af5 /system/lib/libc.so (pthread_kill+52)
I/DEBUG: #2 pc 00017707 /system/lib/libc.so (raise+10)
I/DEBUG: #3 pc 00013f75 /system/lib/libc.so (libc_android_abort+36)
I/DEBUG: #4 pc 00012a3c /system/lib/libc.so (abort+4)
I/DEBUG: #5 pc 00226033 /system/lib/libart.so (art::Runtime::Abort()+170)
I/DEBUG: #6 pc 000a72e9 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
I/DEBUG: #7 pc 0025629d /system/lib/libart.so (art::verifier::MethodVerifier::GetQuickInvokedMethod(art::Instruction const
, art::verifier::RegisterLine
, bool)+280)
I/DEBUG: #8 pc 0025a66b /system/lib/libart.so (art::verifier::MethodVerifier::VerifyInvokeVirtualQuickArgs(art::Instruction const_, bool)+50)
I/DEBUG: #9 pc 0025e7c3 /system/lib/libart.so (art::verifier::MethodVerifier::CodeFlowVerifyInstruction(unsigned int_)+4918)
I/DEBUG: #10 pc 00260323 /system/lib/libart.so (art::verifier::MethodVerifier::CodeFlowVerifyMethod()+142)
I/DEBUG: #11 pc 002607c7 /system/lib/libart.so (art::verifier::MethodVerifier::VerifyCodeFlow()+614)
I/DEBUG: #12 pc 0026093f /system/lib/libart.so (art::verifier::MethodVerifier::Verify()+130)
I/DEBUG: #13 pc 00261feb /system/lib/libart.so (art::verifier::MethodVerifier::FindLocksAtDexPc(art::mirror::ArtMethod_, unsigned int, std::__1::vector<unsigned int, std::__1::allocator >)+334)
I/DEBUG: #14 pc 001f41e5 /system/lib/libart.so (art::Monitor::VisitLocks(art::StackVisitor
, void ()(art::mirror::Object, void_), void_, bool)+252)
I/DEBUG: #15 pc 00233a07 /system/lib/libart.so (art::StackDumpVisitor::VisitFrame()+374)
I/DEBUG: #16 pc 0022dbeb /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+702)
I/DEBUG: #17 pc 002361c9 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits >&) const+224)
I/DEBUG: #18 pc 00225b79 /system/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::1::char_traits >&, art::Thread)+32)
I/DEBUG: #19 pc 00225de3 /system/lib/libart.so (art::AbortState::Dump(std::1::basic_ostream<char, std::1::char_traits >&)+354)
I/DEBUG: #20 pc 00225fdb /system/lib/libart.so (art::Runtime::Abort()+82)
I/DEBUG: #21 pc 000a72e9 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
I/DEBUG: #22 pc 0025629d /system/lib/libart.so (art::verifier::MethodVerifier::GetQuickInvokedMethod(art::Instruction const
, art::verifier::RegisterLine
, bool)+280)
I/DEBUG: #23 pc 0025a66b /system/lib/libart.so (art::verifier::MethodVerifier::VerifyInvokeVirtualQuickArgs(art::Instruction const
, bool)+50)
I/DEBUG: #24 pc 0025e7c3 /system/lib/libart.so (art::verifier::MethodVerifier::CodeFlowVerifyInstruction(unsigned int
)+4918)
I/DEBUG: #25 pc 00260323 /system/lib/libart.so (art::verifier::MethodVerifier::CodeFlowVerifyMethod()+142)
I/DEBUG: #26 pc 002607c7 /system/lib/libart.so (art::verifier::MethodVerifier::VerifyCodeFlow()+614)
I/DEBUG: #27 pc 0026093f /system/lib/libart.so (art::verifier::MethodVerifier::Verify()+130)
I/DEBUG: #28 pc 00261feb /system/lib/libart.so (art::verifier::MethodVerifier::FindLocksAtDexPc(art::mirror::ArtMethod
, unsigned int, std::__1::vector<unsigned int, std::__1::allocator >)+334)
I/DEBUG: #29 pc 001f41e5 /system/lib/libart.so (art::Monitor::VisitLocks(art::StackVisitor
, void ()(art::mirror::Object, void_), void_, bool)+252)
I/DEBUG: #30 pc 00233a07 /system/lib/libart.so (art::StackDumpVisitor::VisitFrame()+374)
I/DEBUG: #31 pc 0022dbeb /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+702)
I/DEBUG: #32 pc 002361c9 /system/lib/libart.so (art::Thread::Dump(std::1::basic_ostream<char, std::1::char_traits >&) const+224)
I/DEBUG: #33 pc 000b1215 /system/lib/libart.so (art::JniAbort(char const
, char const
)+620)
I/DEBUG: #34 pc 000b1945 /system/lib/libart.so (art::JniAbortF(char const
, char const
, ...)+68)
I/DEBUG: #35 pc 000b4bcd /system/lib/libart.so (art::ScopedCheck::ScopedCheck(JNIEnv, int, char const_)+1324)
I/DEBUG: #36 pc 000b5f79 /system/lib/libart.so (art::CheckJNI::NewGlobalRef(JNIEnv, jobject)+28)
I/DEBUG: #37 pc 00015c0f /data/app/com.coulson.phil.master.app-1/lib/arm/libBaiduMapSDK_base_v3_6_1.so (initClass(JNIEnv, _jobject, _jobject, _jclass
)+14)
I/DEBUG: #38 pc 00015cf3 /data/app/com.coulson.phil.master.app-1/lib/arm/libBaiduMapSDK_base_v3_6_1.so (Java_com_baidu_platform_comjni_engine_JNIEngine_initClass+198)
I/DEBUG: #39 pc 00289d79 /data/dalvik-cache/arm/data@app@com.coulson.phil.master.app-1@base.apk@classes.dex
I/DEBUG: Tombstone written to: /data/tombstones/tombstone_05
W/debuggerd_real: type=1400 audit(0.0:6039): avc: denied { signal } for scontext=u:r:init:s0 tcontext=u:r:untrusted_app:s0 tclass=process
I/BootReceiver: Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
E/SharedPreferencesImpl: Couldn't create directory for SharedPreferences file shared_prefs/log_files.xml
D/WifiService: Client connection lost with reason: 4
W/ActivityManager: Force finishing activity com.coulson.phil.master.app/om.coulson.phil.master.main.Launcher
I/Zygote: Process 11196 exited due to signal (6)
I/WindowManager: Screenshot max retries 4 of Token{1d29fc2c ActivityRecord{2c5087df u0 com.coulson.phil.master.app/om.coulson.phil.master.main.Launcher t3468 f}} appWin=Window{b440d71 u0 Starting com.coulson.phil.master.app} drawState=4
E/ActivityManager: Invalid thumbnail dimensions: 576x576
W/ActivityManager: Exception thrown during pause
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:496)
at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:701)
at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:852)
at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2754)
at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2611)
at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2453)
at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:11511)
at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11408)
at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12087)
at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:11603)
at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
E/lowmemorykiller: Error opening /proc/11196/oom_score_adj; errno=2
I/ActivityManager: Process com.coulson.phil.master.app (pid 11196) has died

And I have no idea to fix it!

@CommaYu
Copy link

CommaYu commented Jun 7, 2016

@Phil-Coulson Hello!Recently,i encountered the same question.Did you solve it?

06-07 17:26:54.364: A/art(6733): art/runtime/verifier/method_verifier.cc:3321] Check failed: !Thread::Current()->IsExceptionPending()
06-07 17:26:54.381: D/NAV:MapActivity(6733): msg=1004
06-07 17:26:54.393: A/art(6733): art/runtime/verifier/method_verifier.cc:3321] Check failed: !Thread::Current()->IsExceptionPending()
06-07 17:26:54.393: A/art(6733): art/runtime/runtime.cc:284] Runtime aborting --- recursively, so no thread-specific detail!
06-07 17:26:54.393: A/art(6733): art/runtime/runtime.cc:284]
06-07 17:26:54.393: A/libc(6733): Fatal signal 6 (SIGABRT), code -6 in tid 6765 (GLThread 80)

facebook-github-bot pushed a commit that referenced this issue Apr 17, 2017
Summary:
* Strip out the number in `Class #123`, so that a small change in the number of classes removed doesn't cascade (though renaming needs to be turned off too, of course)
* Allow it to locate `extractdexdump` even if it's invoked with the cwd outside the source tree
* Print some indicators of progress as we extract the APKs

Reviewed By: minjang

Differential Revision: D4883718

fbshipit-source-id: 980352c68271dd36db3ba65878c603e172696d17
@justinjhendrick
Copy link
Contributor

closing due to age. If you still see this error on the newest version, please re-open or create new issue.

@CommaYu
Copy link

CommaYu commented Aug 26, 2017

@justinjhendrick thank you!

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

No branches or pull requests

6 participants