Skip to content

Commit 1986b74

Browse files
authored
Merge pull request #30 from touchlab/jj/crashlytics-sample
Add sample using crashlytics.
2 parents 3cb49c8 + 3b3841e commit 1986b74

File tree

55 files changed

+2194
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2194
-2
lines changed

samples/sample-bugsnag/shared/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ android {
2727
}
2828
}
2929

30-
val CRASHKIOS_VERSION: String by project
31-
3230
version = "0.0.1"
3331

3432
kotlin {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/google-services.json
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2021 Touchlab
3+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
9+
*/
10+
11+
plugins {
12+
id("com.android.application")
13+
kotlin("android")
14+
id("com.google.gms.google-services")
15+
id("com.google.firebase.crashlytics")
16+
}
17+
18+
repositories {
19+
mavenLocal()
20+
google()
21+
mavenCentral()
22+
}
23+
24+
android {
25+
compileSdk = libs.versions.compileSdk.get().toInt()
26+
defaultConfig {
27+
applicationId = "co.touchlab.crashkiossamplecrashlog"
28+
minSdk = libs.versions.minSdk.get().toInt()
29+
targetSdk = libs.versions.targetSdk.get().toInt()
30+
versionCode = 1
31+
versionName = "0.0.1"
32+
}
33+
packagingOptions {
34+
exclude("META-INF/*.kotlin_module")
35+
}
36+
buildTypes {
37+
getByName("release") {
38+
isMinifyEnabled = false
39+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
40+
}
41+
}
42+
compileOptions {
43+
sourceCompatibility = JavaVersion.VERSION_1_8
44+
targetCompatibility = JavaVersion.VERSION_1_8
45+
}
46+
buildFeatures {
47+
viewBinding = true
48+
}
49+
}
50+
51+
dependencies {
52+
implementation(project(":shared"))
53+
implementation(libs.bundles.android)
54+
55+
// Crash reporters
56+
implementation (platform(libs.firebase.bom))
57+
implementation(libs.firebase.analytics)
58+
implementation(libs.firebase.crashlytics)
59+
implementation("co.touchlab.crashkios:crashlytics")
60+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (c) 2021 Touchlab
4+
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
5+
~ You may obtain a copy of the License at
6+
~
7+
~ http://www.apache.org/licenses/LICENSE-2.0
8+
~
9+
~ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10+
-->
11+
12+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
13+
package="co.touchlab.crashkiossamplecrashlog">
14+
15+
<application
16+
android:allowBackup="true"
17+
android:name="co.touchlab.crashkiossamplecrashlog.SampleApp"
18+
android:icon="@mipmap/ic_launcher"
19+
android:label="@string/app_name"
20+
android:roundIcon="@mipmap/ic_launcher_round"
21+
android:supportsRtl="true"
22+
android:theme="@style/Theme.Samplecrashlogging">
23+
<activity
24+
android:name="co.touchlab.crashkiossamplecrashlog.MainActivity"
25+
android:exported="true">
26+
<intent-filter>
27+
<action android:name="android.intent.action.MAIN" />
28+
29+
<category android:name="android.intent.category.LAUNCHER" />
30+
</intent-filter>
31+
</activity>
32+
</application>
33+
34+
</manifest>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2021 Touchlab
3+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
9+
*/
10+
11+
package co.touchlab.crashkiossamplecrashlog
12+
13+
import androidx.appcompat.app.AppCompatActivity
14+
import android.os.Bundle
15+
import co.touchlab.crashkiossample.CrashBot
16+
import co.touchlab.crashkiossample.SampleCommon
17+
import co.touchlab.crashkiossamplecrashlog.databinding.ActivityMainBinding
18+
19+
class MainActivity : AppCompatActivity() {
20+
override fun onCreate(savedInstanceState: Bundle?) {
21+
super.onCreate(savedInstanceState)
22+
val binding = ActivityMainBinding.inflate(layoutInflater)
23+
setContentView(binding.root)
24+
25+
val sampleCommon = SampleCommon()
26+
binding.clickCount.setOnClickListener{
27+
sampleCommon.onClick()
28+
}
29+
binding.logException.setOnClickListener{
30+
sampleCommon.logException()
31+
}
32+
binding.crash.setOnClickListener {
33+
CrashBot().goCrash()
34+
}
35+
}
36+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2021 Touchlab
3+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
9+
*/
10+
11+
package co.touchlab.crashkiossamplecrashlog
12+
13+
import android.app.Application
14+
import co.touchlab.crashkios.crashlytics.enableCrashlytics
15+
16+
class SampleApp : Application() {
17+
18+
override fun onCreate() {
19+
super.onCreate()
20+
21+
enableCrashlytics()
22+
}
23+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
~ Copyright (c) 2021 Touchlab
3+
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
4+
~ You may obtain a copy of the License at
5+
~
6+
~ http://www.apache.org/licenses/LICENSE-2.0
7+
~
8+
~ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
9+
-->
10+
11+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
12+
xmlns:aapt="http://schemas.android.com/aapt"
13+
android:width="108dp"
14+
android:height="108dp"
15+
android:viewportWidth="108"
16+
android:viewportHeight="108">
17+
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
18+
<aapt:attr name="android:fillColor">
19+
<gradient
20+
android:endX="85.84757"
21+
android:endY="92.4963"
22+
android:startX="42.9492"
23+
android:startY="49.59793"
24+
android:type="linear">
25+
<item
26+
android:color="#44000000"
27+
android:offset="0.0" />
28+
<item
29+
android:color="#00000000"
30+
android:offset="1.0" />
31+
</gradient>
32+
</aapt:attr>
33+
</path>
34+
<path
35+
android:fillColor="#FFFFFF"
36+
android:fillType="nonZero"
37+
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
38+
android:strokeWidth="1"
39+
android:strokeColor="#00000000" />
40+
</vector>

0 commit comments

Comments
 (0)