简体   繁体   English

任务 ':app:generateDebugBuildConfig' Flutter 执行失败

[英]Execution failed for task ':app:generateDebugBuildConfig' Flutter


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.deneme_kaynak">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="${applicationName}"
        android:label="deneme_kaynak"
        android:icon="@mipmap/launcher_icon"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true">

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:exported="true"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            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" />
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background"
                />
            <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 -->
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>


ERROR错误

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Execution failed for task ':app:generateDebugBuildConfig'.出了什么问题:任务“:app:generateDebugBuildConfig”执行失败。

Error while evaluating property 'namespace' of task ':app:generateDebugBuildConfig' Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'namespace'.评估任务 ':app:generateDebugBuildConfig' 的属性 'namespace' 时出错 无法计算任务 ':app:generateDebugBuildConfig' 属性 'namespace' 的值。 > Failed to calculate the value of property 'namespace'. > 无法计算属性“命名空间”的值。 > org.xml.sax.SAXParseException; > org.xml.sax.SAXParseException; systemId: file:/Users/ddo/Desktop/projects/yedek/deneme_kaynak/android/app/src/main/AndroidManifest.xml; systemId:文件:/Users/ddo/Desktop/projects/yedek/deneme_kaynak/android/app/src/main/AndroidManifest.xml; lineNumber: 27;行号:27; columnNumber: 56;列号:56; Attribute "exported" bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "activity".已为元素“activity”指定了绑定到命名空间“http://schemas.android.com/apk/res/android”的属性“exported”。

  • Try:尝试:

Run with --stacktrace option to get the stack trace.使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.使用 --info 或 --debug 选项运行以获得更多日志 output。 Run with --scan to get full insights.运行 --scan 以获得完整的见解。

flutter run --verbose flutter 运行 --verbose


[        ] > Task :app:compileDebugRenderscript NO-SOURCE
[        ] > Task :app:generateDebugBuildConfig FAILED
[        ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[        ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[        ] See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 26 actionable tasks: 2 executed, 24 up-to-date
[        ] FAILURE: Build failed with an exception.
[   +1 ms] * What went wrong:
[        ] Execution failed for task ':app:generateDebugBuildConfig'.
[        ] > Error while evaluating property 'namespace' of task ':app:generateDebugBuildConfig'
[        ]    > Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'namespace'.
[        ]       > Failed to calculate the value of property 'namespace'.
[        ]          > org.xml.sax.SAXParseException; systemId: file:/Users/ddo/Desktop/projects/yedek/deneme_kaynak/android/app/src/main/AndroidManifest.xml; lineNumber: 27; columnNumber: 56; Attribute "exported"
bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "activity".
[        ] * Try:
[        ] > Run with --stacktrace option to get the stack trace.
[        ] > Run with --info or --debug option to get more log output.
[        ] > Run with --scan to get full insights.
[        ] * Get more help at https://help.gradle.org
[        ] BUILD FAILED in 5s
[ +349 ms] Running Gradle task 'assembleDebug'... (completed in 7.1s)
[+7242 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +1 ms] "flutter run" took 15,386ms.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:699:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>
           
           
[  +70 ms] ensureAnalyticsSent: 69ms
[        ] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

tried./gradlew clean试过了。/gradlew clean

You have android:exported="true " this twice in manifest file please remove one.您在清单文件中有两次android:exported="true " 请删除一次。 在此处输入图像描述

EDIT编辑

You need to add for this element as well您还需要为此元素添加

<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver" android:exported="true">

its applicable to all services, activity and receiver declared in manifets file: https://cafonsomota.medium.com/android-12-dont-forget-to-set-android-exported-on-your-activities-services-and-receivers-3bee33f37beb它适用于清单文件中声明的所有服务、活动和接收器: https://cafonsomota.medium.com/android-12-dont-forget-to-set-android-exported-on-your-activities-services-and-接收器-3bee33f37beb

This is how manifest file looks:这是清单文件的外观:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.deneme_kaynak">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="${applicationName}"
        android:label="deneme_kaynak"
        android:icon="@mipmap/launcher_icon"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true">

        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:exported="true"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            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" />
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background"
                />
            <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 -->
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
      

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 任务“:app:generateDebugBuildConfig”执行失败。 扑腾 - Execution failed for task ':app:generateDebugBuildConfig'. in flutter 任务 &#39;:app:generateDebugBuildConfig 执行失败 - Execution failed for task ':app:generateDebugBuildConfig 错误:任务 'app:generateDebugBuildConfig' 执行失败 - Error:Execution failed for task 'app:generateDebugBuildConfig' 在 Android Studio 中运行 Flutter 应用程序时出错:任务 ':app:generateDebugBuildConfig' 执行失败 - ERROR When Running Flutter App in Android Studio: Execution failed for task ':app:generateDebugBuildConfig' Flutter 错误:任务“:app:generateDebugBuildConfig”执行失败。 (/android/app/src/main/AndroidManifest.xml 中的问题) - Flutter error : Execution failed for task ':app:generateDebugBuildConfig'. (problem in /android/app/src/main/AndroidManifest.xml ) 我遇到了什么问题:任务&#39;:app:generateDebugBuildConfig&#39;的执行失败。 &gt; \\ AndroidManifest.xml中 - I am getting What went wrong: Execution failed for task ':app:generateDebugBuildConfig'. >\AndroidManifest.xml 构建 React Native 应用程序失败:任务 :app:generateDebugBuildConfig FAILED - Building React Native app fails: Task :app:generateDebugBuildConfig FAILED Flutter 运行:任务 &#39;:app:processDebugResources&#39; 执行失败 - Flutter run: Execution failed for task ':app:processDebugResources' 任务&#39;:app:transformDexArchiveWithExternalLibsDexMergerForDebug&#39;的执行失败。 扑 - Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. Flutter Flutter 中的任务 &#39;:app:mergeDebugResources&#39; 执行失败 - Execution failed for task ':app:mergeDebugResources' in Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM