从Android Studio项目中完全删除Fabric和Firebase

时间:2018-09-17 07:28:02

标签: firebase google-fabric

每当我尝试从android studio项目中删除Fabric和Firebase时,我都会遇到错误和警告。我几乎从项目中删除了那些实现的所有实现,但是在gradle中仍然看到一些崩溃解决方案。我如何彻底清理这些。我的项目中不需要任何 firebase / fabric

我的应用程序级别Gradle:

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

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

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


android {
compileSdkVersion 26
defaultConfig {
    applicationId 'drpg.ddkeys'
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 4
    versionName '4.4.42'
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    versionNameSuffix 'blaze'
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
buildToolsVersion '27.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.2'

}

apply plugin: 'com.google.gms.google-services'

我的项目级别gradle:

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

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

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


android {
compileSdkVersion 26
defaultConfig {
    applicationId 'drpg.ddkeys'
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 4
    versionName '4.4.42'
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    versionNameSuffix 'blaze'
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
productFlavors {
}
buildToolsVersion '27.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:1)

您还可以检查Upgrade to the Firebase Crashlytics SDK。它为您提供了删除Fabric Crashlytics SDK并将其替换为Firebase Crashlytics的详细说明。

此页面还概述了新的Firebase SDK中的Fabric Crashlytics方法及其替代方法。

答案 1 :(得分:0)

来自Fabric的Mike。得知您要删除Fabric,很抱歉,如果您有任何反馈意见,请发送电子邮件至support(at)fabric(dot)io。

从应用的build.gradle中删除:

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

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'

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

从项目的build.gradle中删除:

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

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'

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

如果您在AndroidManifest.xml中看到Fabric API密钥,请删除该值:

   <meta-data
            android:name="io.fabric.ApiKey"
            android:value="YourKey"
            />

如果您有crashlytics.propertiesfabric.properties文件,请删除该文件。

如果您在应用程序中看到Fabric init语句,请将其删除。一个例子:

Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());

如果您有用于Firebase的google-services.json文件,请将其删除。文件的开头看起来像这样:

 "project_info": {
    "project_number": "number",
    "firebase_url": "firebase_url",
    "project_id": "your-project-id",
  }

最终,最好的选择是查看添加依赖项时的提交历史记录并将其删除。由于Firebase和Fabric都是模块化的,因此我无法给出完美的答案。