简体   繁体   中英

Firebase Performance SDK not detected on Android app

I have created a project on Firebase and added the Firebase performance SDK as below,

build.gradle (app)

apply plugin: 'com.google.firebase.firebase-perf'

dependencies {
    implementation platform('com.google.firebase:firebase-bom:26.2.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-perf'
}

build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.1'
    classpath 'com.google.gms:google-services:4.3.4'
    classpath 'com.google.firebase:perf-plugin:1.3.4'
}

AndroidManifest.xml

 <meta-data
     android:name="firebase_performance_logcat_enabled"
     android:value="true" />

 <meta-data
     android:name="firebase_performance_collection_enabled"
     android:value="true" />

But still, it shows to add SDK,

Below are the logs from FirebasePerformance

D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.
D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.
D/FirebasePerformance: Creating a new Non Verbose Session: cb90e041768b41e1af4468b5f1a98360
D/FirebasePerformance: CollectionEnabled metadata key unknown or value not found in manifest.
D/FirebasePerformance: Creating a new Non Verbose Session: 14b444366e4844628a6441ac147cf4a5
D/FirebasePerformance: Transport is not initialized yet, trace metric: _as (duration: 662.1190ms) will be queued for to be dispatched later

Can anyone tell me what went wrong?

Have you added below lines to your project level build.gradle

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

repositories {
// Check that you have the following line (if not, add it):
google()  // Google's Maven repository
}

Also you have not defined version for your depedencies

implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.google.firebase:firebase-perf:19.0.11'

According to the documentation , it is enabled by default (initialized by FirebaseApp ).

Check for gradle.properties , if not that may override it... since the error message makes little sense (no sense at all), maybe once try do delete all build directories and Gradle caches.

You can safely remove that part:

<meta-data
    android:name="firebase_performance_collection_enabled"
    android:value="true" />

Sorry, I forgot to add google plugin

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM