C. Molendijk
C. Molendijk

Reputation: 2834

Xamarin Forms App crash on android 8.1 and lower | JNI DETECTED ERROR IN APPLICATION: mid == null

I've got an Xamarin Forms app that works great on Android 9 but crash at startup on all Android versions lower then 9. I get this log back from Google:

Build fingerprint: 'Sony/G8441/G8441:8.0.0/47.1.A.12.205/2573353275:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 17140, tid: 17140, name: .chrismo.MW.App  >>> nl.chrismo.MW.App <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: mid == null'
    x0   0000000000000000  x1   00000000000042f4  x2   0000000000000006  x3   0000000000000008
    x4   fefeff772b0a763f  x5   fefeff772b0a763f  x6   fefeff772b0a763f  x7   7f7f7f7f7f7f7f7f
    x8   0000000000000083  x9   33cb7ced8929b120  x10  0000000000000000  x11  0000000000000001
    x12  ffffffffffffffff  x13  ffffffffffffffff  x14  ffffffffff000000  x15  ffffffffffffffff
    x16  000000782d8d82f8  x17  000000782d879e30  x18  0000000000000020  x19  00000000000042f4
    x20  00000000000042f4  x21  000000780ebd7640  x22  0000000000000002  x23  0000000000000a1b
    x24  0000000000000021  x25  000000780ebbc800  x26  0000000000000a1a  x27  0000007ff81a4890
    x28  0000000000000059  x29  0000007ff81a4730  x30  000000782d82df14
    sp   0000007ff81a46f0  pc   000000782d879e38  pstate 0000000060000000
backtrace:
    #00 pc 0000000000069e38  /system/lib64/libc.so (tgkill+8)
    #01 pc 000000000001df10  /system/lib64/libc.so (abort+88)
    #02 pc 0000000000437154  /system/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+528)
    #03 pc 0000000000437864  /system/lib64/libart.so (_ZN3art7Runtime7AborterEPKc+24)
    #04 pc 000000000052260c  /system/lib64/libart.so (_ZN7android4base10LogMessageD1Ev+900)
    #05 pc 00000000002d5e48  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1716)
    #06 pc 00000000002d6114  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+176)
    #07 pc 0000000000341970  /system/lib64/libart.so (_ZN3art3JNI20CallStaticIntMethodVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+1356)
    #08 pc 000000000000de38  /data/app/nl.chrismo.MW.App-eSJjo5kzWcbla7tQXsAoRA==/split_config.arm64_v8a.apk (offset 0x146000)
    #09 pc 000000000000ddcc  /data/app/nl.chrismo.MW.App-eSJjo5kzWcbla7tQXsAoRA==/split_config.arm64_v8a.apk (offset 0x146000)
    #10 pc 0000000000004b5c  <anonymous:000000782b45c000>

So this is not much to go on. Localy it works great on our test devices and in the simulators. Also when we run it in release mode. Only difference is that when we run it on devices and simulators, we build it with Visual Studio and when we push it to the store we run the following build script:

msbuild -restore MW.App.Android.csproj -t:SignAndroidPackage -p:Configuration=Release -p:AndroidKeyStore=True -p:AndroidSigningKeyStore={KEYSTOREFILE} -p:AndroidSigningStorePass={PASSWORD} -p:AndroidSigningKeyAlias={SIGNINGKEYALIAS} -p:AndroidSigningKeyPass={SIGNINGKEYPASS} 

So this is then the result of the prelaunch report.

Prelaunch report

My Xamaring Android options:

Xamarin Android Options

Does anyone got an idee where to start debugging this issue?

Upvotes: 2

Views: 1180

Answers (1)

C. Molendijk
C. Molendijk

Reputation: 2834

The problem was with the packaging to .aab file and it is an known issue. See this text on https://learn.microsoft.com/en-us/xamarin/android/release-notes/9/9.4#known-issues-2.

GitHub 3298: "JNI DETECTED ERROR IN APPLICATION: mid == null" or "CallStaticIntMethodV received NULL jclass" "... in call to CallStaticIntMethodV ... from void mono.android.Runtime.init" will prevent apps built using an Install location other than Internal Only from running successfully when installed via Google Play on devices running Android versions between 6.0 Marshmallow (API level 23) and 8.1 Oreo (API level 28).

So the problem is that it fails when you not set your install location to Internal Only. You can do this in the Android Manifest (right click on you Android App -> Properties -> Android Manifest). By putting Install location to Internal Only you fix this issue. See screenshot

enter image description here

Upvotes: 4

Related Questions