Fixed
Status Update
Comments
uc...@google.com <uc...@google.com> #2
Can you share error logs and idea.log file for this issue.
de...@gmail.com <de...@gmail.com> #3
I have reproduced and logged the crash. Attached are idea.log and logcat logs. Any other logs needed?
The crash occurred around 2018-12-13 01:05 Local time (UTC+2), in logcat this is at 2018-12-12 18:05.
The crash occurred around 2018-12-13 01:05 Local time (UTC+2), in logcat this is at 2018-12-12 18:05.
de...@gmail.com <de...@gmail.com> #4
Also attaching the sample project I'm using to reproduce - just add a breakpoint inside Java_com_example_jnibugrepro_MainActivity_stringToJNI() as indicated above.
uc...@google.com <uc...@google.com>
es...@google.com <es...@google.com>
ar...@google.com <ar...@google.com> #5
Sorry we took so long to reply. Is this issue still reproduceable now? Thanks!
em...@google.com <em...@google.com> #6
We have a repro and will try to find a fix for this issue.
Meanwhile, you can prevent the segfault using these workarounds:
- Option 1: Use an x86_64 binary deployed onto an x86_64 emulator.
- Option 2: Add this (weirdly simple) LLDB Post-Attach command: print 1
de...@gmail.com <de...@gmail.com> #7
Thanks for providing the workarounds, though I have just tried to reproduce with the latest Android Studio, SDK and NDK and I was not able to reproduce.
Description
I have reproduced this with function arguments and local variables.
Steps to repro - based on "Empty Activity" template with C++ support:
Native code:
extern "C" JNIEXPORT void JNICALL
Java_com_example_jnibugrepro_MainActivity_stringToJNI(
JNIEnv *env,
jobject /* this */,
jstring str) {
const char *chars = env->GetStringUTFChars(str, nullptr); // Setting a breakpoint here will trigger the crash
env->ReleaseStringUTFChars(str, chars);
}
Java code:
package com.example.jnibugrepro;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
static {
System.loadLibrary("native-lib");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
stringToJNI("test");
}
public native void stringToJNI(String s);
}
Build: 3.2.1, AI-181.5540.7.32.5056338, 201810090144,
AI-181.5540.7.32.5056338, JRE 1.8.0_152-release-1136-b06x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1536x864
Android Gradle Plugin: 3.2.1
Gradle: 4.6
NDK: from local.properties: 18.1.5063045; latest from SDK: 18.1.5063045;
LLDB: LLDB 3.1 (revision: 3.1.4508709)
CMake: from local.properties: (not specified); latest from SDK: 3.6.0-rc2; from PATH: (not found);
IMPORTANT: Please read