无法找到任何与com.google.firebase匹配的版本:firebase-sessions:[15.0.0,16.0.0)

pkbketx9  于 2023-08-07  发布在  Go
关注(0)|答案(2)|浏览(115)

我正在使用Flutter为我的应用程序构建一个apk。
Flutter医生结果:

Flutter is already up to date on channel stable
Flutter 3.10.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f468f3366c (8 days ago) • 2023-07-12 15:19:05 -0700
Engine • revision cdbeda788a
Tools • Dart 3.0.6 • DevTools 2.23.1

字符串
最近,apk构建总是失败,因为这个错误:

* What went wrong:
Execution failed for task ':app:checkReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Could not find any version that matches com.google.firebase:firebase-sessions:[15.0.0, 16.0.0).
     Versions that do not match: 1.0.0
     Required by:
         project :app > project :firebase_crashlytics > com.google.firebase:firebase-crashlytics:18.4.0


以下是我正在使用的Firebase包:

firebase_analytics: ^10.4.4
firebase_crashlytics: ^3.3.4
firebase_core: ^2.15.0
cloud_firestore: ^4.8.3
firebase_storage: ^11.2.5
firebase_auth: ^4.7.1
cloud_functions: ^4.3.4


Gradle版本:

Android gradle plugin version: 7.4.2
Gradle version: 7.6.2


请帮助,因为我找不到任何解决这个新问题!
以下是Gradle Android级别:

buildscript {
    ext.kotlin_version = '1.8.22'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.7'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}


以下是gradle应用级别:

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
    }
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 33
    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 {
        applicationId "com.myappid.app"
        minSdkVersion 24
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics-ktx:21.3.0'
}

z9smfwbn

z9smfwbn1#

经过大量的调试,我来知道,问题所造成的onesign库简单地删除他们,因为在较新版本的onesign它被弃用更多的信息,请遵循下面的链接
Onesignal link

qlvxas9a

qlvxas9a2#

目前唯一的解决方案是使用旧版本的Firebase包。
打开Android Studio项目终端
1.运行“ Flutter 清理”命令
1.运行“pod cache clean --all”命令
1.运行“flutter pub cache clean”命令
(同时删除pubspec.lock和podfile.lock文件)
现在在pubspec.yaml中使用您想要的Firebase包和这些版本:

firebase_analytics: 10.4.3
  firebase_crashlytics: 3.3.3
  firebase_core: 2.14.0
  cloud_firestore: 4.8.1
  firebase_storage: 11.2.3
  firebase_auth: 4.6.3
  cloud_functions: 4.3.3

字符串
确保删除软件包版本号前的“^”。
1.运行“flutter pub get”命令
1.运行“cd ios”然后运行“pod update”命令
好了
注意:如果您使用OneSignal进行通知,请尝试接受的答案。

相关问题