浏览代码

[Android] Crashlytics

j8
Lyubomir Marinov 9 年前
父节点
当前提交
d875b35b32

+ 34
- 17
android/app/build.gradle 查看文件

@@ -1,4 +1,15 @@
1
-apply plugin: "com.android.application"
1
+buildscript {
2
+    repositories {
3
+        maven { url 'https://maven.fabric.io/public' }
4
+    }
5
+
6
+    dependencies {
7
+        classpath 'io.fabric.tools:gradle:1.+'
8
+    }
9
+}
10
+
11
+apply plugin: 'com.android.application'
12
+apply plugin: 'io.fabric'
2 13
 
3 14
 import com.android.build.OutputFile
4 15
 
@@ -65,7 +76,7 @@ import com.android.build.OutputFile
65 76
  * ]
66 77
  */
67 78
 
68
-apply from: "../../node_modules/react-native/react.gradle"
79
+apply from: '../../node_modules/react-native/react.gradle'
69 80
 
70 81
 /**
71 82
  * Set this to true to create two separate APKs instead of one:
@@ -84,24 +95,24 @@ def enableProguardInReleaseBuilds = false
84 95
 
85 96
 android {
86 97
     compileSdkVersion 23
87
-    buildToolsVersion "23.0.1"
98
+    buildToolsVersion '23.0.1'
88 99
 
89 100
     defaultConfig {
90
-        applicationId "org.jitsi.jitsi_meet_react"
101
+        applicationId 'org.jitsi.jitsi_meet_react'
91 102
         minSdkVersion 16
92 103
         targetSdkVersion 22
93 104
         versionCode 1
94
-        versionName "1.0"
105
+        versionName '1.0'
95 106
         ndk {
96
-            abiFilters "armeabi-v7a", "x86"
107
+            abiFilters 'armeabi-v7a', 'x86'
97 108
         }
98 109
         packagingOptions {
99 110
             // The project react-native does not provide 64-bit binaries at the
100 111
             // time of this writing. Unfortunately, packaging any 64-bit
101 112
             // binaries into the .apk will crash the app at runtime on 64-bit
102 113
             // platforms.
103
-            exclude "lib/x86_64/libjingle_peerconnection_so.so"
104
-            exclude "lib/arm64-v8a/libjingle_peerconnection_so.so"
114
+            exclude 'lib/x86_64/libjingle_peerconnection_so.so'
115
+            exclude 'lib/arm64-v8a/libjingle_peerconnection_so.so'
105 116
         }
106 117
     }
107 118
     splits {
@@ -109,13 +120,13 @@ android {
109 120
             reset()
110 121
             enable enableSeparateBuildPerCPUArchitecture
111 122
             universalApk false  // If true, also generate a universal APK
112
-            include "armeabi-v7a", "x86"
123
+            include 'armeabi-v7a', 'x86'
113 124
         }
114 125
     }
115 126
     buildTypes {
116 127
         release {
117 128
             minifyEnabled enableProguardInReleaseBuilds
118
-            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
129
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
119 130
         }
120 131
     }
121 132
     // applicationVariants are e.g. debug, release
@@ -123,7 +134,7 @@ android {
123 134
         variant.outputs.each { output ->
124 135
             // For each separate APK per architecture, set a unique version code as described here:
125 136
             // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
126
-            def versionCodes = ["armeabi-v7a":1, "x86":2]
137
+            def versionCodes = ['armeabi-v7a':1, 'x86':2]
127 138
             def abi = output.getFilter(OutputFile.ABI)
128 139
             if (abi != null) {  // null for the universal-debug, universal-release variants
129 140
                 output.versionCodeOverride =
@@ -133,17 +144,23 @@ android {
133 144
     }
134 145
 }
135 146
 
136
-if (project.hasProperty("JITSI_SIGNING")
137
-        && new File(project.property("JITSI_SIGNING")).exists()) {
138
-    apply from: project.property("JITSI_SIGNING");
147
+if (project.hasProperty('JITSI_SIGNING')
148
+        && new File(project.property('JITSI_SIGNING')).exists()) {
149
+    apply from: project.property('JITSI_SIGNING');
139 150
 }
140 151
 
152
+repositories {
153
+    maven { url 'https://maven.fabric.io/public' }
154
+}
141 155
 dependencies {
142 156
     compile project(':react-native-vector-icons')
143 157
     compile project(':react-native-webrtc')
144
-    compile fileTree(dir: "libs", include: ["*.jar"])
145
-    compile "com.android.support:appcompat-v7:23.0.1"
146
-    compile "com.facebook.react:react-native:+"  // From node_modules
158
+    compile fileTree(dir: 'libs', include: ['*.jar'])
159
+    compile 'com.android.support:appcompat-v7:23.0.1'
160
+    compile 'com.facebook.react:react-native:+'
161
+    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
162
+        transitive = true
163
+    }
147 164
 }
148 165
 
149 166
 apply from: '../../node_modules/react-native-vector-icons/fonts.gradle'

+ 3
- 0
android/app/src/main/AndroidManifest.xml 查看文件

@@ -43,5 +43,8 @@
43 43
       </activity>
44 44
       <activity
45 45
         android:name="com.facebook.react.devsupport.DevSettingsActivity" />
46
+      <meta-data
47
+        android:name="io.fabric.ApiKey"
48
+        android:value="a8ae24a58302ba79da1d312138e941f6b86e3242" />
46 49
     </application>
47 50
 </manifest>

+ 10
- 0
android/app/src/main/java/org/jitsi/jitsi_meet_react/MainActivity.java 查看文件

@@ -1,8 +1,11 @@
1 1
 package org.jitsi.jitsi_meet_react;
2 2
 
3
+import android.os.Bundle;
4
+import com.crashlytics.android.Crashlytics;
3 5
 import com.facebook.react.ReactActivity;
4 6
 import com.facebook.react.ReactActivityDelegate;
5 7
 import com.facebook.react.ReactRootView;
8
+import io.fabric.sdk.android.Fabric;
6 9
 
7 10
 public class MainActivity extends ReactActivity {
8 11
     /**
@@ -43,4 +46,11 @@ public class MainActivity extends ReactActivity {
43 46
     protected String getMainComponentName() {
44 47
         return "App";
45 48
     }
49
+
50
+    @Override
51
+    protected void onCreate(Bundle savedInstanceState) {
52
+        super.onCreate(savedInstanceState);
53
+
54
+        Fabric.with(this, new Crashlytics());
55
+    }
46 56
 }

正在加载...
取消
保存