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: java_class == null #32

Closed
tayseer9 opened this issue Dec 3, 2019 · 14 comments
Closed

JNI DETECTED ERROR IN APPLICATION: java_class == null #32

tayseer9 opened this issue Dec 3, 2019 · 14 comments

Comments

@tayseer9
Copy link

tayseer9 commented Dec 3, 2019

Hello guys, i'm facing an application crush on Android devices whenever Pdf screen starts only in release version.
I looked up in the Logcat and found this error:

12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: java_class == null
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] in call to GetMethodID
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] from com.shockwave.pdfium.b.a com.shockwave.pdfium.PdfiumCore.nativeGetPageSizeByIndex(long, int, int)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] "AsyncTask #6" prio=5 tid=25 Runnable
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x12f432e0 self=0x5583b064e0
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | sysTid=29637 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0x7f6a26f450
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 40724999 342552 21 ) utm=4 stm=0 core=5 HZ=100
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | stack=0x7f6a16d000-0x7f6a16f000 stackSize=1037KB
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] | held mutexes= "mutator lock"(shared held)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #00 pc 000000000048b870 /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+200)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #01 pc 000000000045a620 /system/lib64/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+224)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #02 pc 000000000030ea74 /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1004)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #03 pc 000000000030f448 /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+224)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #04 pc 000000000035a7d0 /system/lib64/libart.so (_ZN3art3JNI11GetMethodIDEP7_JNIEnvP7_jclassPKcS6_+1048)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #05 pc 0000000000004620 /data/app/com.dmn.digitalkiosk-1/lib/arm64/libjniPdfium.so (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex+328)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] native: #06 pc 00000000005ca9f4 /data/app/com.dmn.digitalkiosk-1/oat/arm64/base.odex (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex__JII+152)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at com.shockwave.pdfium.PdfiumCore.nativeGetPageSizeByIndex(Native method)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at com.shockwave.pdfium.PdfiumCore.b(:-1)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] - locked <0x072a7c88> (a java.lang.Object)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.g.c(:-1)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.g.<init>(:-1)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.c.a(:-1)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at c.c.a.a.c.doInBackground(:-1)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at android.os.AsyncTask$2.call(AsyncTask.java:295)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Thread.run(Thread.java:818)
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/java_vm_ext.cc:410]
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/runtime.cc:368] Runtime aborting...
12-03 21:06:08.034 29544-29637/? A/art: art/runtime/runtime.cc:368]
12-03 21:06:08.034 29544-29637/? A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 29637 (AsyncTask #6)
12-03 21:06:08.094 607-607/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-03 21:06:08.094 607-607/? A/DEBUG: Build fingerprint: 'samsung/c7ltezh/c7ltechn:6.0.1/MMB29M/C7000ZHU2APJ2:user/release-keys'
12-03 21:06:08.094 607-607/? A/DEBUG: Revision: '4'
12-03 21:06:08.094 607-607/? A/DEBUG: ABI: 'arm64'
12-03 21:06:08.094 607-607/? A/DEBUG: pid: 29544, tid: 29637, name: AsyncTask #6 >>> com.dmn.digitalkiosk <<<
12-03 21:06:08.094 607-607/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
12-03 21:06:08.124 607-607/? A/DEBUG: Abort message: 'art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: java_class == null'
12-03 21:06:08.124 607-607/? A/DEBUG: x0 0000000000000000 x1 00000000000073c5 x2 0000000000000006 x3 0000000000000000
12-03 21:06:08.124 607-607/? A/DEBUG: x4 0000000000000000 x5 0000000000000001 x6 0000000000000000 x7 0000000000000000
12-03 21:06:08.124 607-607/? A/DEBUG: x8 0000000000000083 x9 0000007f8a983a70 x10 0000000000000003 x11 0000000000000140
12-03 21:06:08.124 607-607/? A/DEBUG: x12 0000005583e2f6f0 x13 0000005582ed3000 x14 0000000000000000 x15 00000000fffffff2
12-03 21:06:08.124 607-607/? A/DEBUG: x16 0000007f8a97c6a8 x17 0000007f8a93ec6c x18 0000000000000000 x19 0000007f6a26f510
12-03 21:06:08.124 607-607/? A/DEBUG: x20 0000007f6a26f450 x21 0000000000000003 x22 0000000000000006 x23 0000005583a13fc0
12-03 21:06:08.124 607-607/? A/DEBUG: x24 0000007f870191d0 x25 0000005583b064e0 x26 0000005582ee7530 x27 0000000000000001
12-03 21:06:08.124 607-607/? A/DEBUG: x28 0000005583e7ecf0 x29 0000007f6a26e510 x30 0000007f8a93c408
12-03 21:06:08.124 607-607/? A/DEBUG: sp 0000007f6a26e510 pc 0000007f8a93ec74 pstate 0000000020000000
12-03 21:06:08.124 607-607/? A/DEBUG: backtrace:
12-03 21:06:08.124 607-607/? A/DEBUG: #00 pc 000000000006ac74 /system/lib64/libc.so (tgkill+8)
12-03 21:06:08.124 607-607/? A/DEBUG: #01 pc 0000000000068404 /system/lib64/libc.so (pthread_kill+68)
12-03 21:06:08.124 607-607/? A/DEBUG: #02 pc 0000000000021328 /system/lib64/libc.so (raise+28)
12-03 21:06:08.124 607-607/? A/DEBUG: #03 pc 000000000001bc58 /system/lib64/libc.so (abort+60)
12-03 21:06:08.124 607-607/? A/DEBUG: #04 pc 0000000000431978 /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+304)
12-03 21:06:08.124 607-607/? A/DEBUG: #05 pc 00000000001373e4 /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+3136)
12-03 21:06:08.124 607-607/? A/DEBUG: #06 pc 000000000030eeac /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+2084)
12-03 21:06:08.124 607-607/? A/DEBUG: #07 pc 000000000030f448 /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+224)
12-03 21:06:08.124 607-607/? A/DEBUG: #08 pc 000000000035a7d0 /system/lib64/libart.so (_ZN3art3JNI11GetMethodIDEP7_JNIEnvP7_jclassPKcS6_+1048)
12-03 21:06:08.124 607-607/? A/DEBUG: #09 pc 0000000000004620 /data/app/com.dmn.digitalkiosk-1/lib/arm64/libjniPdfium.so (Java_com_shockwave_pdfium_PdfiumCore_nativeGetPageSizeByIndex+328)
12-03 21:06:08.124 607-607/? A/DEBUG: #10 pc 00000000005ca9f4 /data/app/com.dmn.digitalkiosk-1/oat/arm64/base.odex (offset 0x3ca000)

can you please tell me how to fix this issue..

@Dhaval2404
Copy link

I got the same error for the release build. For debug build its working fine.

@endigo
Copy link
Owner

endigo commented Dec 5, 2019

Hey, guys, you need to add
-keep class com.shockwave.** to your proguard definition file.

@endigo endigo closed this as completed Dec 5, 2019
@tayseer9
Copy link
Author

tayseer9 commented Dec 5, 2019

@endigo thanks.. it works now.
removing minifyEnabled from build.gradle did fix the problem too.

@divan
Copy link

divan commented Dec 24, 2019

@endigo could you please provide more info for people who has no previous experience with Android development and have no idea where to look for that file? Thank you in advance!

@endigo
Copy link
Owner

endigo commented Dec 24, 2019

@divan
Copy link

divan commented Dec 24, 2019

@endigo thank you, looking into it now. One question though – I currently doesn't have neither minification nor proguard enabled, and still experience this issue – does it make sense to enable minification/proguard just to solve this issue? (I assume it all disabled by default in flutter)

UPD. Fix worked, but still trying to understand if it's minification that caused the bug or something else.

@endigo
Copy link
Owner

endigo commented Dec 24, 2019

@divan final production apk size is too large if you disable this configuration.

@divan
Copy link

divan commented Dec 24, 2019

@endigo thank you so much for such a quick responses and help!

@uzairpawaskar
Copy link

i have got the same error if someone can help? i even added proguard line.. and other possible things mentioned,..

@abraar14
Copy link

abraar14 commented Apr 26, 2020

Anyone got a workaround with this error, it seems like R8 is pre-enabled when building an apk in Flutter. Would disabling it make it work?

Edit: It worked in my case, I don't think this is good practice if one needs a lighter app but I will take it for now. I used flutter build apk --no-shrink

@imSanjaySoni
Copy link

imSanjaySoni commented May 7, 2020

Hey, guys, you need to add
-keep class com.shockwave.** to your proguard definition file.

hey, sir, I don't have knowledge of build.gradle, I got this error while building a release app

Could not compile build file '/Users/sanjaysoni/Desktop/Credicxo/FlutterApp/android/app/build.gradle'.
> startup failed:                                                       
  build file '/Users/sanjaysoni/Desktop/Credicxo/FlutterApp/android/app/build.gradle': 79: expecting '}', found 'class' @ line 79, column 30.
                            -keep class com.shockwave.**                
                                  ^                                     
                                                                        
  1 error

I have pasted the -keep class com.shockwave.** like this

       release {
           signingConfig signingConfigs.release
           useProguard true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
           matchingFallbacks = ['release']
            shrinkResources true
            minifyEnabled true

           ndk {
               abiFilters 'armeabi-v7a'
           }
                       -keep class com.shockwave.**

        
       }
       enterprise {
           matchingFallbacks = ['release']
       }
       debug {
           minifyEnabled false
           useProguard false
           matchingFallbacks = ['debug']
       }
   }

can you give me exact idea for this, thank you.

@uzairpawaskar
Copy link

@imSanjaySoni check this if it helps
yashpaneliya/PDF-Viewer-Flutter#3 (comment)

@imSanjaySoni
Copy link

thanks, its worked

Hey, guys, you need to add
-keep class com.shockwave.** to your proguard definition file.

@bachbonglong
Copy link

@endigo thanks.. it works now.
removing minifyEnabled from build.gradle did fix the problem too.

It work for me. You save my life . I spent many time to fix . Thanks you so much

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

8 participants