我正在尝试通过 firebase 实现网络日志记录。
我已按照此处的步骤进行操作,但是在同步 gradle 时出现以下错误:
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.firebase.firebase-perf', version: '1.4.2', apply: false] was not found in any of the following sources:
这是我的顶级/项目的一部分
gradle.build
文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
classpath "com.squareup:javapoet:1.13.0"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.6'
classpath 'org.jacoco:org.jacoco.core:0.8.8'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.5.0.2730"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
id 'com.google.firebase.firebase-perf' version '1.4.2' apply false <-- this is the line causing the issue
}
这是我的模块应用程序的一部分
gradle.build
:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
...........................
...........................
...........................
//Analytics
implementation platform('com.google.firebase:firebase-bom:32.4.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-perf-ktx'
步骤非常简单,我不知道我哪里出了问题或者可能是什么。 here提出了类似的问题,但是那里没有有用的信息。
如果有经历过类似事情的人可以提供一些线索,我真的很感激,如果你没有,也许你可以提供一些线索。
谢谢
以防万一有人遇到这个问题。我发现问题了。
一个非常简单的修复和一个非常愚蠢的错误。我当时正在运行 Charles Proxy,而 charles 正在干扰网络,从而影响了 gradle。