我已经了解过 stackoverflow 解决方案。什么都不起作用。 这是我的 android/build.gradle:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.google.gms:google-services:4.4.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://phonepe.mycloudrepo.io/public/repositories/phonepe-intentsdk-android"
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
这是我的应用程序/build.gradle:
plugins {
id "com.android.application"
id "com.google.gms.google-services" apply true
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
// Make sure that you have the Google services Gradle plugin
// id 'com.google.gms.google-services'
// Add the Crashlytics Gradle plugin
// id 'com.google.firebase.crashlytics'
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.jbullsinfotech.flutter_template"
compileSdkVersion 34
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.jbullsinfotech.flutter_template"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
// Import the BoM for the Firebase platform
// implementation(platform("com.google.firebase:firebase-bom:32.7.0"))
// Add the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
// implementation("com.google.firebase:firebase-crashlytics")
// implementation("com.google.firebase:firebase-analytics")
// This dependency is downloaded from the Google’s Maven repository.
// So, make sure you also include that repository in your project's build.gradle file.
implementation 'com.google.android.play:app-update:2.1.0'
// For Kotlin users also add the Kotlin extensions library for Play In-App Update:
implementation 'com.google.android.play:app-update-ktx:2.1.0'
}
// This must appear at the bottom of the file
//apply plugin: 'com.google.firebase.crashlytics'
crashlytics 工作正常,但分析给了我这个错误。通过 flutterfire cli 配置应用程序。已经检查过 google-services.json。我在任何地方都没有看到错误。导入了核心、cashlytics 和分析,但即使在调试视图中也没有分析记录。
我的项目中也遇到同样的问题。如果您有任何解决方案请评论..