[android] add: Crashlytics integrated.

This commit is contained in:
Alexander Marchuk 2016-03-22 19:11:27 +03:00 committed by Sergey Yershov
parent 84d34da308
commit 7dc3239cce
3 changed files with 41 additions and 1 deletions

View file

@ -69,6 +69,10 @@
android:name="com.parse.push.notification_icon"
android:resource="@drawable/ic_notification"/>
<meta-data
android:name="io.fabric.ApiKey"
android:value="${FABRIC_API_KEY}"/>
<activity
android:name="com.mapswithme.maps.DownloadResourcesActivity"
android:configChanges="orientation|screenLayout|screenSize"

View file

@ -1,10 +1,14 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'io.fabric.tools:gradle:1.+'
}
}
@ -15,8 +19,15 @@ allprojects {
}
}
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
apply plugin: 'com.android.application'
apply from: 'secure.properties'
apply plugin: 'io.fabric'
dependencies {
// android support libs
@ -31,6 +42,8 @@ dependencies {
compile 'com.google.android.gms:play-services-plus:8.4.0'
// crash reporting
compile 'net.hockeyapp.android:HockeySDK:3.7.1'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.2@aar') { transitive = true }
// 3-party
compile 'com.facebook.android:facebook-android-sdk:4.10.0'
compile 'com.parse.bolts:bolts-android:1.4.0'
@ -54,6 +67,12 @@ def getDate() {
project.ext.versionCodes = ['armeabi-v7a': 1, 'x86': 2]
project.ext.appId = 'com.mapswithme.maps.pro'
crashlytics {
enableNdk true
androidNdkOut 'obj/local'
androidNdkLibsOut 'libs'
}
android {
// All properties are read from gradle.properties file
compileSdkVersion propTargetSdkVersion.toInteger()
@ -69,6 +88,12 @@ android {
buildConfigField 'String', 'SUPPORT_MAIL', '"android@maps.me"'
buildConfigField 'String', 'REVIEW_URL', '"market://details?id=com.mapswithme.maps.pro"'
buildConfigField 'int', 'RATING_THRESHOLD', '5'
// Crashlytics API key
Properties props = new Properties()
props.load(new FileInputStream("${projectDir}/fabric.properties"));
manifestPlaceholders = [ 'FABRIC_API_KEY': props['apiKey'] ]
buildConfigField 'String', 'FABRIC_API_KEY', /"${props['apiKey']}"/
}
sourceSets.main {

View file

@ -13,6 +13,8 @@ import android.util.Log;
import java.io.File;
import java.util.List;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.ndk.CrashlyticsNdk;
import com.mapswithme.maps.background.AppBackgroundTracker;
import com.mapswithme.maps.background.Notifier;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
@ -32,6 +34,7 @@ import com.parse.Parse;
import com.parse.ParseException;
import com.parse.ParseInstallation;
import com.parse.SaveCallback;
import io.fabric.sdk.android.Fabric;
import net.hockeyapp.android.CrashManager;
public class MwmApplication extends Application
@ -101,11 +104,13 @@ public class MwmApplication extends Application
super.onCreate();
mMainLoopHandler = new Handler(getMainLooper());
initHockeyApp();
initCrashlytics();
initPaths();
nativeInitPlatform(getApkPath(), getDataStoragePath(), getTempPath(), getObbGooglePath(),
BuildConfig.FLAVOR, BuildConfig.BUILD_TYPE,
Yota.isFirstYota(), UiUtils.isTablet());
initHockeyApp();
initParse();
mPrefs = getSharedPreferences(getString(R.string.pref_file_name), MODE_PRIVATE);
mBackgroundTracker = new AppBackgroundTracker();
@ -169,6 +174,12 @@ public class MwmApplication extends Application
CrashManager.register(this, id);
}
private void initCrashlytics()
{
if (!BuildConfig.FABRIC_API_KEY.startsWith("0000"))
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
}
public boolean isFrameworkInitialized()
{
return mIsFrameworkInitialized;