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

huangapple go评论60阅读模式
英文:

Could not find any version that matches com.google.firebase:firebase-sessions:[15.0.0, 16.0.0)

问题

I'm using Flutter to build an apk for my application.

Flutter doctor result:

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

Recently, the apk build always failed because of this error:

* 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

Here are the Firebase packages I'm using:

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 versions:

Android gradle plugin version: 7.4.2
Gradle version: 7.6.2

Please help, because I could not find any solution for this new problem!

Here is the gradle android level:

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
}

Here is the gradle app level:

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'
}
英文:

I'm using Flutter to build an apk for my application.

Flutter doctor result:

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

Recently, the apk build always failed because of this error:

* 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

Here are the Firebase packages I'm using:

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 versions:

Android gradle plugin version: 7.4.2
Gradle version: 7.6.2

Please help, because I could not find any solution for this new problem!

Here is the gradle android level:

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
}

Here is the gradle app level:

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

答案1

得分: 6

经过大量的调试,我发现问题是由于OneSignal库引起的,只需将其移除,因为在较新版本的OneSignal中,它已被弃用。有关更多信息,请参阅下面的链接:

OneSignal链接

英文:

After plenty of debugging i come to know that the issue caused by onesignal library simply remove them because in newer version of onesignal it was deprecated for more info please follow below link

Onesignal link

答案2

得分: 0

以下是翻译好的部分:

现在的唯一解决方案是使用较旧版本的Firebase包。

打开Android Studio项目终端

  1. 运行 "flutter clean" 命令
  2. 运行 "pod cache clean --all" 命令
  3. 运行 "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" 命令
  2. 运行 "cd ios" 然后 "pod update" 命令

完成。

注意:如果你正在使用OneSignal进行通知,请尝试接受的答案。

英文:

The only solution for now is to use older versions of Firebase packages.

Open Android Studio project terminal

  1. Run "flutter clean" command
  2. Run "pod cache clean --all" command
  3. Run "flutter pub cache clean" command

(Delete also pubspec.lock and podfile.lock files)

Now use the Firebase packages you want with these versions in pubspec.yaml:

  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

Make sure to remove "^" before the package version number.

  1. Run "flutter pub get" command
  2. Run "cd ios" then "pod update" commands

Done.

Note: if you are using OneSignal for notifications, try the accepted answer.

huangapple
  • 本文由 发表于 2023年7月20日 21:18:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76730332.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定