【问题标题】:Flutter Unresolved class 'ApplicationName'颤振未解决的类 \'ApplicationName\'
【发布时间】:2022-10-06 11:21:37
【问题描述】:

我想将我的应用程序上传到 git,它会发出警告,当我说显示警告时,我会收到这样的错误。我刚刚打开了 android 文件夹并进行了同步,但我无法得到结果。此问题仅在尝试将我的项目上传到 git 时发生。我尝试了很多方法但失败了 我该如何解决这个问题?

    <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"
    xmlns:tools=\"http://schemas.android.com/tools\"
    package=\"com.example.apmatik\"
    tools:ignore=\"MissingVersion\">
   <application
        android:label=\"apmatik\"
        android:name=\"${applicationName}\"
        android:icon=\"@mipmap/ic_launcher\">
        <activity
            android:name=\".MainActivity\"
            android:exported=\"true\"
            android:launchMode=\"singleTop\"
            android:theme=\"@style/LaunchTheme\"
            android:configChanges=\"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode\"
            android:hardwareAccelerated=\"true\"
            android:windowSoftInputMode=\"adjustResize\">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
                android:name=\"flutterEmbedding\"
                android:value=\"2\"
                android:resource=\"@style/NormalTheme\"
              />
            <intent-filter>
                <action android:name=\"android.intent.action.MAIN\"/>
                <category android:name=\"android.intent.category.LAUNCHER\"/>
            </intent-filter>
        </activity>
        <!-- Don\'t delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name=\"flutterEmbedding\"
            android:value=\"2\" />
    </application>
</manifest>

    标签: android flutter


    【解决方案1】:

    解决方案1:

    在我们的app/build.gradle 中手动设置manifestPlaceholders

    android {
    ⋮
    defaultConfig {
       ⋮
        // Add This line
        manifestPlaceholders = [applicationName: "android.app.Application"]
       }
       ⋮
     }
    

    解决方案 2: 在app/build.gradle 中添加此代码:

        buildTypes {
        release {
            manifestPlaceholders = [applicationName: "android.app.Application"]
        }
    
        debug {
            manifestPlaceholders = [applicationName: "android.app.Application"]
        }
        build{
            manifestPlaceholders = [applicationName: "android.app.Application"]
        }
      }
    

    【讨论】:

    • 感谢您的回答,但不起作用!我的 gradle 插件版本:7.2.1 gradle 版本:7.4.2 和 android studio:Android Studio Chipmunk | 2021.2.1
    • 你找到解决方案了吗?打开我的 Android Manifest 文件并弹出所有这些错误。
    【解决方案2】:

    如果您的应用程序确实编译,那么这不是您的问题,而是 Android Studio linter 问题。

    【讨论】:

      猜你喜欢
      • 2020-08-10
      • 2021-11-20
      • 2021-07-11
      • 2020-12-16
      • 2021-11-05
      • 2022-01-11
      • 2020-10-15
      • 2020-10-16
      • 2021-05-02
      相关资源
      最近更新 更多