feat(android): Start adding Sentry SDK

This commit is contained in:
Darcy Wong 2020-02-28 10:53:11 +07:00
parent 765eccd229
commit e49583e088
5 changed files with 24 additions and 0 deletions

View file

@ -6,10 +6,12 @@ buildscript {
maven {
url 'https://maven.fabric.io/public'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'io.sentry:sentry-android-gradle-plugin:1.7.31'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'name.remal:gradle-plugins:1.0.157'
}

View file

@ -1,5 +1,6 @@
plugins {
id 'com.android.application'
id 'io.sentry.android.gradle'
id 'io.fabric'
id 'com.github.triplet.play' version '2.5.0' apply false
id 'name.remal.default-plugins'
@ -12,6 +13,11 @@ android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.tavultesoft.kmapro"
minSdkVersion 19
@ -71,6 +77,7 @@ android {
lintOptions {
disable 'MissingTranslation'
lintConfig file("lint.xml")
}
}
@ -104,6 +111,7 @@ repositories {
dirs 'libs'
}
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
@ -114,6 +122,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0-alpha02'
implementation 'com.google.android.material:material:1.0.0'
api(name: 'keyman-engine', ext: 'aar')
implementation 'io.sentry:sentry-android:2.0.0'
implementation 'org.slf4j:slf4j-nop:1.7.25'
implementation "com.google.firebase:firebase-analytics:17.2.1"
implementation "com.google.firebase:firebase-messaging:20.0.1"
implementation "com.google.firebase:firebase-crash:16.2.1"

View file

@ -1,3 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
<issue id="InvalidPackage">
<ignore path="**/sentry*.jar"/>
</issue>
</lint>

View file

@ -21,6 +21,9 @@
</intent-filter>
</receiver>
<meta-data
android:name="io.sentry.dsn" android:value="https://2f067e5571a74974b9e210ca76ca9607@sentry.keyman.com/7" />
<service
android:name="com.keyman.android.SystemKeyboard"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"

View file

@ -86,6 +86,8 @@ import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import io.sentry.core.Sentry;
public class MainActivity extends AppCompatActivity implements OnKeyboardEventListener, OnKeyboardDownloadEventListener,
ActivityCompat.OnRequestPermissionsResultCallback {
public static Context context;
@ -150,6 +152,10 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
context = this;
// Send a simple event to Sentry
Sentry.captureMessage("This is a test 2");
resultReceiver = new DownloadResultReceiver(new Handler());
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);