Skip to content

Commit

Permalink
Added crash button to sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
LandryNorris committed Jul 12, 2022
1 parent 3b89167 commit bef86d0
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class JNIMethodScope {

fun method(name: String, block: JNIMethod.() -> Unit) {
val method = JNIMethod()
method.name = name
method.block()
methods.add(method)
}
Expand Down
Binary file modified sample/src/androidMain/jniLibs/arm64-v8a/libsample.so
Binary file not shown.
Binary file modified sample/src/androidMain/jniLibs/armeabi-v7a/libsample.so
Binary file not shown.
Binary file modified sample/src/androidMain/jniLibs/x86/libsample.so
Binary file not shown.
Binary file modified sample/src/androidMain/jniLibs/x86_64/libsample.so
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object JniBridge {
external fun buttonClicked(ptr: Long)
external fun getText(ptr: Long): String
external fun createRepository(): Long
external fun crash(message: String)
}

class JavaClass {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class MainActivity: AppCompatActivity() {
buttonRepository.buttonClicked()
label.text = buttonRepository.getText()
}

findViewById<Button>(R.id.btnCrash).setOnClickListener {
JniBridge.crash("App requested a Fatal Error")
}
}

private fun testJni() {
Expand Down
15 changes: 11 additions & 4 deletions sample/src/androidMain/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:layout_height="wrap_content"/>

<Button android:id="@+id/button"
android:text="Count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

<Button android:id="@+id/btnCrash"
android:text="Crash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>

0 comments on commit bef86d0

Please sign in to comment.