Flutter AndroidManifest警告 - 当前最小版本为1。

9

AndroidManifest.xml file gives warnings -

Attribute hardwareAccelerated is only used in API level 11 and higher(current min is 1)
Attribute windowSoftInputMode is only used in API level 3 and higher(current min is 1)

并且

Should set android:versionCode to specify the application version
Should set android:versionName to specify the application version

此外
App is not indexable by Google Search;

应用程序/build.gradle文件的内容如下 -

compileSdkVersion 28
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger() // 1
versionName flutterVersionName // '1.0'

最近我的应用出现了警告,但没有进行任何新的升级。我的旧版Flutter项目从未遇到这些警告,并且仍然可以正常工作。

我尝试过以下方法:

  1. 文件 > 无效缓存 / 重启.... > 无效并重启
  2. 只是重新启动
  3. 从头开始创建一个不同的项目

解决警告的方法:

<uses-sdk android:minSdkVersion="16"
 android:targetSdkVersion="28" />

在 AndroidManifest.xml 中使用<uses-sdk.../>可以解决警告(当前最小版本为1),但同时也会使app/build.gradle文件的使用无效。请问有任何建议吗? 我正在使用Android Studio 3.2.1。
1个回答

1
这对我来说很有效。
使用这些命令来清理和修复插件。
$ flutter clean
$ flutter pub cache repair

app/build.gradle :

android {
    namespace 'com.akbon.app' / add your package name
    compileSdk 33
    ndkVersion flutter.ndkVersion
    defaultConfig {
        applicationId "com.akbon.app" / add your package name
        minSdkVersion 21
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
// 

AndroidManifest.xml:

<application
    android:name="${applicationName}"
    tools:targetApi="33" 
//

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接