当前位置: 首页 > 知识库问答 >
问题:

安装flutter本地通知后,我想我可能在AndriodManifest.xml文件中给出了权限

杨昆
2023-03-14

我AndriodManifest.xml文件代码在这里

manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.clock_app">
   
   <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.VIBRATE" />
   
   <application
        android:label="clock_app"
        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="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <receiver android:name="com.dexterous.flutterlocalnotifications.
            ScheduledNotificationBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.
        ScheduledNotificationReceiver" />
        </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>

我得到如下错误

#FAILURE:生成失败,出现异常。

    < li >哪里出错:任务执行失败:app:processDebugResources。

执行com.android.build.gradle.internal.tasks.Workers$ActionFacade Android资源链接失败时发生故障G:\时钟\clock_app\build\app\中介\packaged_manifests\debug\AndroidManifest.xml:51: AAPT: error:在.

 G:\clock\clock_app\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:57: AAPT: error: unexpected element <receiver> found in <manifest><application><activity>.

2.

#请任何人帮助我摆脱这个错误

共有1个答案

姚骁
2023-03-14

移动您的<代码>

    manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.clock_app">
       
       <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
        <uses-permission android:name="android.permission.VIBRATE" />
       
       <application
            android:label="clock_app"
            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="io.flutter.embedding.android.NormalTheme"
                  android:resource="@style/NormalTheme"
                  />
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
            <receiver android:name="com.dexterous.flutterlocalnotifications.
                ScheduledNotificationBootReceiver">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>
                    <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
                </intent-filter>
            </receiver>
            <receiver android:name="com.dexterous.flutterlocalnotifications.
            ScheduledNotificationReceiver" />
            <!-- 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>
 类似资料:
  • 安装后,cordova推送通知插件,我得到以下错误时,运行android应用程序。 配置根项目'Android'时出现问题。 找不到com.android.tools.build:gradle:2.2.3。 在以下位置搜索:https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom htt

  • 不幸的是,我删除了Python的一些文件。我有macOS Catalina,我想用以下命令安装pytorch: 错误:命令出错,退出状态为1:/library/framework/python.framework/versions/3.8/bin/python3.8-u-c'import sys,setuptools,tokenize;sys.argv[0]=‘“’”‘/private/var/f

  • 我正在使用离子,我已经通过git从机器1到机器2获取了我的项目。 我的爱奥尼亚信息告诉我: [错误]错误/node\u模块/@离子/应用程序脚本/包。json文件:找不到file\u cli包:(/usr/local/lib/node\u模块) 本地套餐: 系统: 杂项: 当我运行sudo npm install时,我得到以下信息: npm WARN checkPermissions缺少对/Use

  • 我想用FCM和这个包实现本地通知,我是这样实现的:首先:我在我的项目上安装FCM和Flutter本地通知包,然后,我在Android系统中创建一个应用静态编程语言类- 申请代码: 舱单代码: 我也在稳定频道,但它不工作,我把频道改为beta,但仍然不工作 颤振医生: 颤振文件: main.dart代码: 但我有一个错误: 我在谷歌上搜索了很多,发现了一些类似的问题,比如这个。但这对我不起作用。