Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[android] Remove Fabric and Crashlytics on Android #8211

Merged
merged 2 commits into from May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -79,7 +79,6 @@ jarjar-rules.txt
/android/app/src/main/AndroidManifest.xml
/android/app/google-services.json
/android/expoview/src/main/java/host/exp/exponent/generated/ExponentKeys.java
/android/app/fabric.properties
/apps/bare-expo/android/app/google-services.json
/apps/bare-expo/ios/BareExpo/GoogleService-Info.plist
/ios/Exponent/Generated/EXKeys.h
Expand Down
8 changes: 0 additions & 8 deletions android/.gitignore
Expand Up @@ -183,12 +183,6 @@ atlassian-ide-plugin.xml
# Mongo Explorer plugin
.idea/mongoSettings.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### AndroidStudio Patch ###

!/gradle/wrapper/gradle-wrapper.jar
Expand Down Expand Up @@ -309,8 +303,6 @@ cmake-build-*/
# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)

# Editor-based Rest Client
.idea/httpRequests

Expand Down
11 changes: 0 additions & 11 deletions android/app/build.gradle
@@ -1,21 +1,11 @@
buildscript {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'devicefarm'

repositories {
maven { url 'https://maven.fabric.io/public' }
}

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
Expand Down Expand Up @@ -63,7 +53,6 @@ android {
buildTypes {
debug {
debuggable true
ext.enableCrashlytics = false
}
release {
minifyEnabled true
Expand Down
8 changes: 0 additions & 8 deletions android/expoview/build.gradle
Expand Up @@ -44,7 +44,6 @@ def safeExtGet(prop, fallback) {

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
// If you have maven { url "https://jitpack.io" } as your resolving url,
// then Jitpack will only return the POM for the Android dependency causing the Gradle sync to fail.
// However, when you change url to "https://www.jitpack.io", Jitpack returns POM, AAR, and sources.jar.
Expand All @@ -61,7 +60,6 @@ buildscript {
}

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://www.jitpack.io" }
mavenCentral()
}
Expand All @@ -87,9 +85,6 @@ android {
}

buildTypes {
debug {
ext.enableCrashlytics = false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -220,9 +215,6 @@ dependencies {

// Our dependencies
api "androidx.appcompat:appcompat:1.1.0"
api('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
api 'de.greenrobot:eventbus:2.4.0'

Expand Down
Expand Up @@ -5,9 +5,6 @@
import android.os.Debug;
import androidx.multidex.MultiDexApplication;

import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import com.crashlytics.android.core.CrashlyticsListener;
import com.facebook.ads.AudienceNetworkAds;
import com.facebook.soloader.SoLoader;

Expand All @@ -28,7 +25,6 @@
import host.exp.exponent.taskManager.ExpoHeadlessAppLoader;
import host.exp.expoview.Exponent;
import host.exp.expoview.ExpoViewBuildConfig;
import io.fabric.sdk.android.Fabric;
import org.unimodules.apploader.AppLoaderProvider;
import me.leolin.shortcutbadger.ShortcutBadger;

Expand Down Expand Up @@ -75,32 +71,6 @@ public KernelInterface create() {

NativeModuleDepsProvider.getInstance().inject(ExpoApplication.class, this);

if (!ExpoViewBuildConfig.DEBUG) {
final CrashlyticsListener listener = new CrashlyticsListener() {
@Override
public void crashlyticsDidDetectCrashDuringPreviousExecution(){
mExponentSharedPreferences.setBoolean(ExponentSharedPreferences.SHOULD_NOT_USE_KERNEL_CACHE, true);
}
};

final CrashlyticsCore core = new CrashlyticsCore
.Builder()
.listener(listener)
.build();

Fabric.with(this, new Crashlytics.Builder().core(core).build());

try {
String versionName = Constants.getVersionName(this);
Crashlytics.setString("exp_client_version", versionName);
if (Constants.INITIAL_URL != null) {
Crashlytics.setString("initial_url", Constants.INITIAL_URL);
}
} catch (Throwable e) {
EXL.e(TAG, e.toString());
}
}

BranchManager.initialize(this);
AudienceNetworkAds.initialize(this);

Expand Down
Expand Up @@ -3,7 +3,6 @@
package host.exp.exponent;

import android.content.Context;
import android.util.Log;

import host.exp.exponent.analytics.EXL;
import host.exp.exponent.experience.ExperienceActivity;
Expand All @@ -25,12 +24,12 @@ public void uncaughtException(Thread thread, Throwable ex) {
try {
ExperienceActivity.removeNotification(mContext);
} catch (Throwable e) {
// Don't ever want to crash before getting to Crashlytics
// Don't ever want to crash before getting to default exception handler
EXL.e(TAG, e);
}

if (mOldExceptionHandler != null) {
// Let Crashlytics know about the crash.
// Let default handler know about the crash.
mOldExceptionHandler.uncaughtException(thread, ex);
}

Expand Down
Expand Up @@ -7,7 +7,6 @@
import org.json.JSONObject;

import host.exp.exponent.Constants;
import host.exp.expoview.Exponent;

// EXpo Log
public class EXL {
Expand All @@ -33,11 +32,8 @@ public static void w(final String tag, final String msg) {
// TODO send string version of Throwable to Amplitude
public static void e(final String tag, final Throwable e) {
Log.e(tag, e.toString());

Exponent.logException(e);
}

// TODO send to Crashlytics
public static void e(final String tag, final String msg) {
Log.e(tag, msg);

Expand Down
Expand Up @@ -1005,9 +1005,6 @@ public static void handleReactNativeError(String errorMessage, Object detailsUnv
public static void handleReactNativeError(Throwable throwable, String errorMessage, Object detailsUnversioned,
Integer exceptionId, Boolean isFatal) {
handleReactNativeError(ExponentErrorMessage.developerErrorMessage(errorMessage), detailsUnversioned, exceptionId, isFatal);
if (throwable != null) {
Exponent.logException(throwable);
}
}

private static void handleReactNativeError(ExponentErrorMessage errorMessage, Object detailsUnversioned,
Expand Down Expand Up @@ -1058,7 +1055,6 @@ public void handleError(String errorMessage) {

public void handleError(Exception exception) {
handleReactNativeError(ExceptionUtils.exceptionToErrorMessage(exception), null, -1, true);
Exponent.logException(exception);
}

private static int getExceptionId(Integer originalId) {
Expand Down
16 changes: 0 additions & 16 deletions android/expoview/src/main/java/host/exp/expoview/Exponent.java
Expand Up @@ -13,9 +13,7 @@
import android.os.StrictMode;
import android.os.UserManager;
import android.provider.Settings;
import android.util.Log;

import com.crashlytics.android.Crashlytics;
import com.facebook.common.internal.ByteStreams;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.stetho.Stetho;
Expand All @@ -39,15 +37,11 @@
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.security.Provider;
import java.security.Security;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.inject.Inject;
Expand Down Expand Up @@ -289,16 +283,6 @@ public Application getApplication() {
return mApplication;
}

public static void logException(Throwable throwable) {
if (!ExpoViewBuildConfig.DEBUG) {
try {
Crashlytics.logException(throwable);
} catch (Throwable e) {
Log.e(TAG, e.toString());
}
}
}

public String encodeExperienceId(final String manifestId) throws UnsupportedEncodingException {
return URLEncoder.encode("experience-" + manifestId, "UTF-8");
}
Expand Down
8 changes: 0 additions & 8 deletions android/versioned-abis/.gitignore
Expand Up @@ -153,12 +153,6 @@
# Mongo Explorer plugin
*/idea/mongoSettings.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
*/om_crashlytics_export_strings.xml
*/rashlytics.properties
*/rashlytics-build.properties
*/abric.properties

### AndroidStudio Patch ###

*//gradle/wrapper/gradle-wrapper.jar
Expand Down Expand Up @@ -206,8 +200,6 @@
# Ruby plugin and RubyMine
*/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

Expand Down
8 changes: 0 additions & 8 deletions android/versioned-abis/expoview-abi34_0_0/build.gradle
Expand Up @@ -10,7 +10,6 @@ def safeExtGet(prop, fallback) {

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://www.jitpack.io" }
mavenCentral()
google()
Expand All @@ -22,7 +21,6 @@ buildscript {
}

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://www.jitpack.io" }
mavenCentral()
}
Expand All @@ -43,9 +41,6 @@ android {
}

buildTypes {
debug {
ext.enableCrashlytics = false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -83,9 +78,6 @@ dependencies {

// Our dependencies
api "androidx.appcompat:appcompat:1.0.0"
api('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
api 'de.greenrobot:eventbus:2.4.0'

Expand Down
8 changes: 0 additions & 8 deletions android/versioned-abis/expoview-abi35_0_0/build.gradle
Expand Up @@ -9,7 +9,6 @@ def safeExtGet(prop, fallback) {

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://www.jitpack.io" }
mavenCentral()
google()
Expand All @@ -21,7 +20,6 @@ buildscript {
}

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://www.jitpack.io" }
mavenCentral()
}
Expand All @@ -42,9 +40,6 @@ android {
}

buildTypes {
debug {
ext.enableCrashlytics = false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -86,9 +81,6 @@ dependencies {

// Our dependencies
api "androidx.appcompat:appcompat:1.0.0"
api('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
api 'de.greenrobot:eventbus:2.4.0'

Expand Down
8 changes: 0 additions & 8 deletions android/versioned-abis/expoview-abi36_0_0/build.gradle
Expand Up @@ -10,7 +10,6 @@ def safeExtGet(prop, fallback) {

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
// If you have maven { url "https://jitpack.io" } as your resolving url,
// then Jitpack will only return the POM for the Android dependency causing the Gradle sync to fail.
// However, when you change url to "https://www.jitpack.io", Jitpack returns POM, AAR, and sources.jar.
Expand All @@ -27,7 +26,6 @@ buildscript {
}

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://www.jitpack.io" }
mavenCentral()
}
Expand All @@ -48,9 +46,6 @@ android {
}

buildTypes {
debug {
ext.enableCrashlytics = false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -92,9 +87,6 @@ dependencies {

// Our dependencies
api "androidx.appcompat:appcompat:1.1.0"
api('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
api 'de.greenrobot:eventbus:2.4.0'

Expand Down