簡體   English   中英

在我的android firebase應用程序中安裝Fabric Crashlytics后,這個Gradle構建錯誤是什么?

[英]What is this Gradle build Error after installing Fabric Crashlytics in my android firebase app?

我嘗試手動添加Fabric Crashlytics,然后嘗試使用插件,但在嘗試構建時遇到了同樣的錯誤:

Error:Execution failed for task ':app:processReleaseManifest'.
> Manifest merger failed : Attribute meta-data#io.fabric.ApiKey@value value=( my api key ) from AndroidManifest.xml:39:13-69
    is also present at [com.firebaseui:firebase-ui-auth:1.2.0] AndroidManifest.xml:20:13-60 value=(@string/twitter_consumer_secret).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:37:9-39:72 to override.

我添加了建議的行(即使我不是真的了解它或知道它是否會導致與firebase-ui-auth的某種沖突)

tools:replace="android:value"

現在我可以構建並運行應用程序,但是當我強行崩潰時:

throw new RuntimeException("This is a crash");

我得到了崩潰報告,雖然他們需要一段時間才能出現。

我的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' }
}




// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")

// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))





android {
    signingConfigs {
        config {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "aaa.bbb.ccc"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.google.android.gms:play-services-auth:10.2.4'
    compile 'com.firebaseui:firebase-ui:1.2.0'
    compile 'com.firebaseui:firebase-ui-auth:1.2.0'
    compile 'com.google.firebase:firebase-auth:10.2.4'
    compile 'com.google.firebase:firebase-core:10.2.4'
    compile 'com.google.firebase:firebase-database:10.2.4'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    testCompile 'junit:junit:4.12'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
}


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

在我的清單中,我已經獲得了互聯網許可,現在已經有效了:

<meta-data
        tools:replace="android:value"
        android:name="io.fabric.ApiKey"
        android:value=" my key " />

我的Android Studio版本是2.3.2那么,明顯的修復是否會引發問題 - 最初的構建錯誤仍然是個問題嗎? 是否有一些我可能會遺漏以避免初始構建錯誤? 謝謝

PS完整的清單文件是:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="aaa.bbb.ccc"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-sdk tools:overrideLibrary="com.firebase.ui, com.firebase.ui.auth"/>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:name=".MainNavDrawerActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar"
            android:screenOrientation="portrait"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:windowSoftInputMode="stateHidden|adjustResize">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            tools:replace="android:value"
            android:name="io.fabric.ApiKey"
            android:value=" my key " />
    </application>

</manifest>

我遇到了同樣的問題,從清單文件中刪除它:

tools:replace="android:value"

最好將鍵放在gradle中,如下所示:

manifestPlaceholders = [fabric_io_id: "key here "]

並將其添加到

       <meta-data
          android:name="io.fabric.ApiKey"
          android:value="${fabric_io_id}"
          tools:replace="android:value"/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM