replace Crittercism with Crashlytics, suckily

Crittercism is dropping free support of FOSS apps, so I'm dropping
it. Unfortunatly integration isn't as clean: so far at least I haven't
figured out how to make it possible for others to build the 'd' variant,
which includes Crashlytics, without their having a Fabric API key.
This commit is contained in:
Eric House 2017-06-20 21:45:44 -07:00
parent 6de5d307b3
commit a16cc8e648
4 changed files with 50 additions and 13 deletions

View file

@ -1,6 +1,8 @@
def INITIAL_CLIENT_VERS = 8
def VERSION_CODE_BASE = 115
def VERSION_NAME = '4.4.119'
def FABRIC_API_KEY = System.getenv("FABRIC_API_KEY")
boolean forFDroid = hasProperty('forFDroid')
// Get the git revision we're using. Since fdroid modifies files as
@ -14,6 +16,14 @@ GITREV = GITREV.execute().text.trim()
apply plugin: 'com.android.application'
if ( FABRIC_API_KEY && hasProperty('useCrashlytics') ) {
apply plugin: 'io.fabric'
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
buildToolsVersion '23.0.3'
defaultConfig {
@ -29,8 +39,7 @@ android {
// variant.buildConfigField "String", "FIELD_NAME", "\"my String\""
def GCM_SENDER_ID = System.getenv("GCM_SENDER_ID")
variant.buildConfigField "String", "SENDER_ID", "\"$GCM_SENDER_ID\""
def CRITTERCISM_APP_ID = System.getenv("CRITTERCISM_APP_ID")
variant.buildConfigField "String", "CRITTERCISM_APP_ID", "\"$CRITTERCISM_APP_ID\""
variant.buildConfigField "String", "FABRIC_API_KEY", "\"$FABRIC_API_KEY\""
resValue "string", "git_rev", "$GITREV"
variant.buildConfigField "String", "GIT_REV", "\"$GITREV\""
@ -63,8 +72,9 @@ android {
}
xw4d {
dimension "variant"
minSdkVersion 8
applicationId "org.eehouse.android.xw4dbg"
manifestPlaceholders = [ APP_ID: applicationId ]
manifestPlaceholders = [ FABRIC_API_KEY: "$FABRIC_API_KEY", APP_ID: applicationId, ]
resValue "string", "app_name", "CrossDbg"
resValue "string", "nbs_port", "3345"
resValue "string", "invite_prefix", "/anddbg/"
@ -160,7 +170,9 @@ dependencies {
compile 'com.android.support:support-v4:23.4.0'
xw4dCompile 'com.crittercism:crittercism-android-agent:+'
xw4dCompile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
}
task mkImages(type: Exec) {

View file

@ -12,8 +12,6 @@
<!-- BE SURE TO MODIFY project.properties AND the variable TARGET in
../scripts/setup_local_props.sh if targetSdkVersion changes!!!
-->
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="23" />
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
@ -75,6 +73,9 @@
</intent-filter>
</activity>
<!-- NOT in the non-d version -->
<meta-data android:name="io.fabric.ApiKey" android:value="${FABRIC_API_KEY}" />
<activity android:name="DictsActivity"
android:label="@string/title_dicts_list"
android:configChanges="keyboardHidden|orientation|screenSize"

View file

@ -1,4 +1,4 @@
/* -*- compile-command: "find-and-gradle.sh insXw4Deb"; -*- */
/* -*- compile-command: "find-and-gradle.sh -PuseCrashlytics insXw4dDeb"; -*- */
/*
* Copyright 2014 by Eric House (xwords@eehouse.org). All rights reserved.
*
@ -21,16 +21,38 @@ package org.eehouse.android.xw4;
import android.content.Context;
// This class exists solely to allow crittercism to be included in a small
// file that can be different in variants. GamesList.java is too big.
import com.crittercism.app.Crittercism;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
// This class exists solely to allow crashlytics to be included in a small
// file that can be different in flavors.
public class CrashTrack {
private static final String TAG = CrashTrack.class.getSimpleName();
public static void init( Context context ) {
if ( 0 < BuildConfig.CRITTERCISM_APP_ID.length() ) {
Crittercism.initialize(context.getApplicationContext(),
BuildConfig.CRITTERCISM_APP_ID );
if ( 0 < BuildConfig.FABRIC_API_KEY.length() ) {
// Crashlytics/Fabric sample code wants this between onCreate()'s
// super() call and the call to setContentView(). We'll see if
// this works.
Fabric.with( context, new Crashlytics() );
// Now crash as a test
if ( false ) {
new Thread( new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {}
String nullStr = null;
if ( nullStr.equals("") ) {
Log.d( TAG, "something's very wrong" );
}
}
} ).start();
}
}
}
}

View file

@ -3,9 +3,11 @@
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files