30

I've just setup my first Cordova project and installed OneSignal push notifications. This is all working as I expect, however the Android Developer Tools are showing this in the console:

W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
I/art: WaitForGcToComplete blocked for 6.202ms for cause Background
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread
W/art: Attempt to remove non-JNI local reference, dumping thread

This message is constantly output while the app is running.

What does it mean and how can I resolve whatever issue there is?

1

4 Answers 4

23

It seems that the problem is related to this Chromium bug. Quoting the bug report:

On recent versions of ART with CheckJNI turned on, this causes a spammy warning to be printed to logcat stating "Attempt to remove non-JNI local reference, dumping thread" with a thread dump, as apparently parameters are not supposed to be deleted, only objects returned as local references from native->java JNI calls. This is not actually a problem since the runtime just does nothing in this case (other than printing the warning), but it's spammy for webview-using applications that may want to run development builds with checkjni enabled.

This is different from the host GPU emulation issue, which would crash the app instead of letting it run with spammy warnings.

I've looked quite a bit, but couldn't find a way to disable CheckJNI on ART (even though it is possible for Dalvik). My current workaround is to filter the logcat. To do this, select the text of the warning in the logcat window of Android Studio, then right click it and choose Fold lines like this.

1
  • Remember to crop the filter for the fold, otherwise it will only fold the line matching the timestamp.
    – Karlth
    Commented Feb 13, 2019 at 15:13
19

The entries are not related to OneSignal. From the following threads this looks to be a bug with the WebView and can happen more often on enumerators while using host GPU is off. See the below threads referring to this.

5

If you're a developer getting this message in your own app, make sure you're not accidentally deleting local references given as parameters to your JNI methods.

i.e. don't do this:

JNIEXPORT void JNICALL Java_my_app_MyClass_myMethod
    (JNIEnv* env, jobject self, jobject someParam) {
    env->DeleteLocalRef(someParam);
}
0

In my case, it's because I have a CSS animation in my WebView (animation: donut-spin 1.2s linear infinite;) that is causing this error message.

I tried what is described at https://issuetracker.google.com/issues/37065041#comment10 but it didn't work… So I just comment my CSS animation while running in emulator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.