diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c28c74e..83cbfca 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -58,7 +58,7 @@
android:screenOrientation="portrait"/>
diff --git a/app/src/main/java/cn/salesuite/saf/kotlin/activity/CrashActivity.kt b/app/src/main/java/cn/salesuite/saf/kotlin/activity/CrashActivity.kt
new file mode 100644
index 0000000..6380603
--- /dev/null
+++ b/app/src/main/java/cn/salesuite/saf/kotlin/activity/CrashActivity.kt
@@ -0,0 +1,38 @@
+package cn.salesuite.saf.kotlin.activity
+
+import android.Manifest
+import android.app.Activity
+import android.content.pm.PackageManager
+import android.os.Bundle
+import androidx.core.app.ActivityCompat
+import androidx.core.content.ContextCompat
+
+/**
+ *
+ * @FileName:
+ * cn.salesuite.saf.kotlin.activity.CrashActivity
+ * @author: Tony Shen
+ * @date: 2021-10-14 21:08
+ * @version: V1.0 <描述当前版本功能>
+ */
+class CrashActivity: Activity() {
+
+ public override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
+ if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
+ ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 0)
+ }
+
+ throw NullPointerException()
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
+
+ if (requestCode==0) {
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/salesuite/saf/kotlin/activity/MainActivity.kt b/app/src/main/java/cn/salesuite/saf/kotlin/activity/MainActivity.kt
index 76b4074..aa184e6 100644
--- a/app/src/main/java/cn/salesuite/saf/kotlin/activity/MainActivity.kt
+++ b/app/src/main/java/cn/salesuite/saf/kotlin/activity/MainActivity.kt
@@ -62,10 +62,10 @@ class MainActivity : BaseActivity() {
startActivity(intent)
}
-// text8.setOnClickListener {
-//
-// val intent = Intent(this@MainActivity, JNIActivity::class.java)
-// startActivity(intent)
-// }
+ text8.setOnClickListener {
+
+ val intent = Intent(this@MainActivity, CrashActivity::class.java)
+ startActivity(intent)
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/cn/salesuite/saf/kotlin/app/App.kt b/app/src/main/java/cn/salesuite/saf/kotlin/app/App.kt
index a9f8178..c5734b5 100644
--- a/app/src/main/java/cn/salesuite/saf/kotlin/app/App.kt
+++ b/app/src/main/java/cn/salesuite/saf/kotlin/app/App.kt
@@ -7,6 +7,9 @@ import com.safframework.log.configL
import com.safframework.log.converter.gson.GsonConverter
import com.safframework.log.debugview.DebugViewWrapper
import com.safframework.log.debugview.modules.TimerModule
+import com.safframework.log.printer.FilePrinter
+import com.safframework.log.printer.file.FileBuilder
+import com.safframework.log.utils.CrashUtils
/**
*
@@ -22,6 +25,12 @@ var application: Application? = null
class App : Application() {
+ private var crashPrinter: FilePrinter
+
+ init{
+ crashPrinter = FileBuilder().folderPath("/storage/emulated/0/crash_logs").build()
+ }
+
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
application = this
@@ -36,6 +45,12 @@ class App : Application() {
converter = GsonConverter()
}
+ CrashUtils.init(tag = "crashTag",printer = crashPrinter, onCrashListener = object : CrashUtils.OnCrashListener {
+ override fun onCrash(crashInfo: String, e: Throwable) {
+
+ }
+ })
+
initDebugView()
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2f910a1..e9174e7 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -67,13 +67,13 @@
android:gravity="center"
android:text="在 Java 中使用 L"/>
-
-
-
-
-
-
-
-
+
\ No newline at end of file