当前位置: 首页 > 工具软件 > io.spider > 使用案例 >

【Android】崩溃日志手机端显示工具:SpiderMan

颜奇希
2023-12-01

参考: https://www.wanandroid.com/blog/show/2739

SpiderMan(基于AndroidX)

(1)在整个project的build.gradle中,添加:maven { url 'https://jitpack.io' }

repositories {
        google()
        maven { url 'https://jitpack.io' }
        jcenter()
    }

(2)在模块的build.gradle中,添加:

def spider_man = "v1.1.8"

dependencies {
	...
    implementation "com.github.simplepeng.SpiderMan:spiderman:${spider_man}"
}

(3)在整个工程的Application中,可以更改主题颜色

public class AppApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        //更改主题颜色
        SpiderMan.setTheme(R.style.SpiderManTheme_Dark);
    }
}

(4)随便在某处制造crash,测试功能:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void crash(View view) {
        int i = 1/0;
    }
}
 类似资料: