此手机与此应用程序不兼容

问题描述 投票:0回答:1

这是我在 Google Play 中看到的消息。与我的其他应用程序不同,我也使用类似的 build.gradles 安装在同一设备上。

应用程序/build.gradle: 插件{ id“com.android.application” id“kotlin-android” id“dev.flutter.flutter-gradle-plugin” }

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

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('../../apps-keys/timetap/key.properties')
println("Keystore properties file exists: ${keystorePropertiesFile.exists()}")
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    println("Keystore properties loaded: ${keystoreProperties}")
} else {
    throw new GradleException("Keystore properties file not found: $keystorePropertiesFile")
}

android {
    namespace "com.drodriguez.time_tap"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion
    ndkVersion = '25.1.8937393'

    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.drodriguez.time_tap"
//        minSdkVersion 23
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

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

    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.release
            minifyEnabled true
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "com.android.billingclient:billing:6.1.0"
    implementation "com.google.android.gms:play-services-games-v2:+"
}

如果我尝试这样编译,它会说:

Manifest 合并失败:uses-sdk:minSdkVersion 21 不能更小 高于库 [:firebase_auth] 中声明的版本 23 C:\用户\丹尼\桌面 epos imetap uild irebase_auth\intermediates\merged_manifest\debug\processDebugManifest\AndroidManifest.xml 因为该库可能使用 21 建议中不可用的 API: 使用 minSdk 最多为 21 的兼容库, 或者将该项目的 minSdk 版本增加到至少 23, 或者使用tools:overrideLibrary="io.flutter.plugins.firebase.auth"强制使用(可能会导致运行时失败)

因此,如果我离开

minSdkVersion 23
,我的应用程序编译正常,但部署后,该消息会显示在 Google Play 中。

在 Pixel 8 API 35 (Android 15) 上进行测试

flutter build.gradle google-play-console
1个回答
-1
投票
  1. 将 minSdkVersion 增加到 23 最简单的解决方案是将应用程序的 minSdkVersion 增加到 23,这与 firebase_auth 包兼容。您可以这样做:
android {
    defaultConfig {
        // Other configurations...
        minSdkVersion 23
        // Other configurations...
    }
}

以下是应用覆盖的方法:

  1. 打开项目的 android/app/src/main/AndroidManifest.xml 文件。
  2. 将 tools:overrideLibrary 属性添加到标签或 标签。

<application
    tools:overrideLibrary="io.flutter.plugins.firebase.auth">
    <!-- Other configurations... -->
</application> </manifest>
© www.soinside.com 2019 - 2024. All rights reserved.