I am a software engineer in China, most of my work is on android, react-native, frontend and Node.js.
Collaborator of Node.js, react-native, uvwasi
Currently mainly focus on V8, quic, wasi and compiler staff.
I am a software engineer in China, most of my work is on android, react-native, frontend and Node.js.
Collaborator of Node.js, react-native, uvwasi
Currently mainly focus on V8, quic, wasi and compiler staff.
Ref: https://proandroiddev.com/debugging-native-crashes-in-android-apps-2b86fd7113d8
diff --git a/play-native/src/main/cpp/native-lib.cpp b/play-native/src/main/cpp/native-lib.cpp
index a04454d..f084bff 100644
--- a/play-native/src/main/cpp/native-lib.cpp
+++ b/play-native/src/main/cpp/native-lib.cpp
@@ -15,3 +15,8 @@ Java_com_gengjiawen_play_MainActivity_stringFromJNI(
LOGI("int %d, string: %s", a, hello.c_str());
return env->NewStringUTF(hello.c_str());
}
+extern "C"
+JNIEXPORT jstring JNICALL
+Java_com_gengjiawen_play_MainActivity_segmentTrigger(JNIEnv *env, jobject thiz) {
+ *(int*)0 = 0;
+}
\ No newline at end of file
diff --git a/play-native/src/main/java/com/gengjiawen/play/MainActivity.kt b/play-native/src/main/java/com/gengjiawen/play/MainActivity.kt
index cb1c9a3..d7e3293 100644
--- a/play-native/src/main/java/com/gengjiawen/play/MainActivity.kt
+++ b/play-native/src/main/java/com/gengjiawen/play/MainActivity.kt
@@ -11,9 +11,14 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
titleLabel.text = stringFromJNI()
+ sfButton.setOnClickListener({
+ segmentTrigger()
+ })
+
}
external fun stringFromJNI(): String
+ external fun segmentTrigger(): String
companion object {
diff --git a/play-native/src/main/res/layout/activity_main.xml b/play-native/src/main/res/layout/activity_main.xml
index f504122..1e6d08f 100644
--- a/play-native/src/main/res/layout/activity_main.xml
+++ b/play-native/src/main/res/layout/activity_main.xml
@@ -2,13 +2,20 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/titleLabel"
+ android:layout_width="487dp"
+ android:layout_height="50dp"
+ android:text="Hello World!" />
+
+ <Button
+ android:id="@+id/sfButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Hello World!" />
+ android:text="Segment Fault" />
</LinearLayout>
\ No newline at end of file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.