├── sample ├── app │ ├── .gitignore │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── dimens.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-w820dp │ │ │ │ │ └── dimens.xml │ │ │ │ └── layout │ │ │ │ │ └── activity_main.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── onlinecache │ │ │ │ └── breakpad │ │ │ │ └── demo │ │ │ │ └── MainActivity.java │ │ ├── test │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── onlinecache │ │ │ │ └── breakpad │ │ │ │ └── demo │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── cn │ │ │ └── onlinecache │ │ │ └── breakpad │ │ │ └── demo │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── breakpad │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ └── values │ │ │ │ │ └── strings.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── onlinecache │ │ │ │ └── breakpad │ │ │ │ └── NativeBreakpad.java │ │ ├── test │ │ │ └── java │ │ │ │ └── cn │ │ │ │ └── onlinecache │ │ │ │ └── breakpad │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── cn │ │ │ └── onlinecache │ │ │ └── breakpad │ │ │ └── ExampleInstrumentedTest.java │ ├── libs │ │ ├── mips │ │ │ └── libbreakpad.so │ │ ├── x86 │ │ │ └── libbreakpad.so │ │ ├── armeabi │ │ │ └── libbreakpad.so │ │ ├── mips64 │ │ │ └── libbreakpad.so │ │ ├── x86_64 │ │ │ └── libbreakpad.so │ │ ├── arm64-v8a │ │ │ └── libbreakpad.so │ │ └── armeabi-v7a │ │ │ └── libbreakpad.so │ ├── proguard-rules.pro │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── local.properties ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── .gitmodules ├── Application.mk ├── .gitignore ├── Android.mk ├── base └── common.h ├── include └── cn_onlinecache_breakpad_NativeBreakpad_JNI.h ├── README.md └── native_breakpad.cpp /sample/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':breakpad' 2 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BreakpadDemo 3 | 4 | -------------------------------------------------------------------------------- /sample/breakpad/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Breakpad 3 | 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/breakpad"] 2 | path = third_party/breakpad 3 | url = https://chromium.googlesource.com/breakpad/breakpad 4 | -------------------------------------------------------------------------------- /Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := stlport_static 2 | APP_ABI := all 3 | APP_CXXFLAGS := -std=c++11 -D__STDC_LIMIT_MACROS 4 | APP_PLATFORM := android-12 5 | -------------------------------------------------------------------------------- /sample/breakpad/libs/mips/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/mips/libbreakpad.so -------------------------------------------------------------------------------- /sample/breakpad/libs/x86/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/x86/libbreakpad.so -------------------------------------------------------------------------------- /sample/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | sample/.gradle 4 | sample/breakpad/build 5 | sample/breakpad/obj 6 | sample/app/build 7 | sample/build/ 8 | !build.sh 9 | -------------------------------------------------------------------------------- /sample/breakpad/libs/armeabi/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/armeabi/libbreakpad.so -------------------------------------------------------------------------------- /sample/breakpad/libs/mips64/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/mips64/libbreakpad.so -------------------------------------------------------------------------------- /sample/breakpad/libs/x86_64/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/x86_64/libbreakpad.so -------------------------------------------------------------------------------- /sample/breakpad/libs/arm64-v8a/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/arm64-v8a/libbreakpad.so -------------------------------------------------------------------------------- /sample/breakpad/libs/armeabi-v7a/libbreakpad.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/breakpad/libs/armeabi-v7a/libbreakpad.so -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yinyinnie/breakpad-for-android/HEAD/sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /sample/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | ROOT_PATH := $(call my-dir) 2 | include $(ROOT_PATH)/third_party/breakpad/android/google_breakpad/Android.mk 3 | 4 | LOCAL_PATH := $(ROOT_PATH) 5 | include $(CLEAR_VARS) 6 | 7 | LOCAL_MODULE := breakpad 8 | LOCAL_SRC_FILES := native_breakpad.cpp 9 | LOCAL_LDLIBS := -llog 10 | LOCAL_STATIC_LIBRARIES += breakpad_client 11 | 12 | include $(BUILD_SHARED_LIBRARY) 13 | -------------------------------------------------------------------------------- /sample/breakpad/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /sample/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sample/local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file should *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=/Users/nieyinyin/android-sdks -------------------------------------------------------------------------------- /sample/breakpad/src/test/java/cn/onlinecache/breakpad/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package cn.onlinecache.breakpad; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sample/app/src/test/java/cn/onlinecache/breakpad/demo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package cn.onlinecache.breakpad.demo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.2' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /sample/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/nieyinyin/android-sdks/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/breakpad/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/nieyinyin/android-sdks/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /base/common.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_H__ 2 | #define __COMMON_H__ 3 | #include 4 | #include 5 | 6 | #ifndef DEBUG 7 | #define DEBUG 1 8 | #endif 9 | 10 | #ifdef DEBUG 11 | #define APP_NAME "cn.onlinecache.breakpad" 12 | #define LOGV(...) __android_log_print(2, APP_NAME, __VA_ARGS__) 13 | #define LOGD(...) __android_log_print(3, APP_NAME, __VA_ARGS__) 14 | #define LOGI(...) __android_log_print(4, APP_NAME, __VA_ARGS__) 15 | #define LOGW(...) __android_log_print(5, APP_NAME, __VA_ARGS__) 16 | #define LOGE(...) __android_log_print(6, APP_NAME, __VA_ARGS__) 17 | #else 18 | #define LOGV(...) {} 19 | #define LOGD(...) {} 20 | #define LOGI(...) {} 21 | #define LOGW(...) {} 22 | #define LOGE(...) {} 23 | #endif 24 | #endif /* __COMMON_H__ */ 25 | -------------------------------------------------------------------------------- /sample/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /sample/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/cn_onlinecache_breakpad_NativeBreakpad_JNI.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class cn_onlinecache_breakpad_NativeBreakpad */ 4 | 5 | #ifndef _Included_cn_onlinecache_breakpad 6 | #define _Included_cn_onlinecache_breakpad 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: cn_onlinecache_breakpad_NativeBreakpad 12 | * Method: nativeInit 13 | * Signature: (Ljava/lang/String;)I 14 | */ 15 | JNIEXPORT jint JNICALL Java_cn_onlinecache_breakpad_NativeBreakpad_nativeInit 16 | (JNIEnv *, jobject, jstring); 17 | 18 | /* 19 | * Class: cn_onlinecache_breakpad_NativeBreakpad 20 | * Method: nativeTestCrash 21 | * Signature: * Signature: ()V 22 | */ 23 | JNIEXPORT jint JNICALL Java_cn_onlinecache_breakpad_NativeBreakpad_nativeTestCrash 24 | (JNIEnv *, jobject); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Breakpad-for-android 2 | 这是库简单封装了Google Breakpad, 加上jni层,让你一键集成Breakpad到项目中 3 | 4 | # 如何使用 5 | 6 | ## 下载NDK 7 | 访问[Android官网](https://developer.android.com/ndk/downloads/index.html),从这个网页,你可以直接下载对应操作系统的NDK 8 | 9 | ## 配置NDK 10 | 解压NDK,配置环境变量,以Mac为例,配置如下: 11 | 12 | export NDK_HOME=/Users/nieyinyin/android-ndk-r10e 13 | export PATH=${PATH}:${NDK_HOME} 14 | 15 | ## 编译 16 | 进入工程的根目录,直接运行: 17 | `./build.sh` 18 | 19 | 编译后的.so文件所在:`sample/breakpad/libs` 20 | 21 | ## 集成到App 22 | 1. 拷贝.so文件到你项目的app/libs/ 23 | 2. 拷贝sample/breakpad/src/main/java/cn/onlinecache/breakpad/NativeBreakpad.java到你的工程目录下,**注意:包名不能改哦!!** 24 | 3. 在你的Application类初始化:` NativeBreakpad.init(Environment.getExternalStorageDirectory().getAbsolutePath());` 注意:**这个方法所传的参数你可以直接定义** 25 | 26 | 27 | ** 你也可以无需编译,直接使用sample的breakpad module** 28 | 29 | 与工程配套的文章教程:https://www.jianshu.com/p/c1ff71c9b5ef 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /sample/app/src/androidTest/java/cn/onlinecache/breakpad/demo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package cn.onlinecache.breakpad.demo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("cn.onlinecache.breakpad", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/breakpad/src/androidTest/java/cn/onlinecache/breakpad/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package cn.onlinecache.breakpad; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("cn.onlinecache.breakpad.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 |