#android #flutter #dart #visual-studio-code #build
#Android #трепетать #дротик #visual-studio-код #строить
Вопрос:
Я пытался создать приложение flutter. Но при экспорте/сборке возникла ошибка. Сообщение об ошибке при построении:
Launching libmain.dart on Android SDK built for x86 in debug mode... libmain.dart:1 C:devbmiandroidappsrcmainAndroidManifest.xml Error: Package name 'BMI' at position AndroidManifest.xml:2:5-18 should contain at least one '.' (dot) character FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugMainManifest'. gt; Manifest merger failed : Package name 'BMI' at position AndroidManifest.xml:2:5-18 should contain at least one '.' (dot) character * 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 21s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)
andriodmainifest.xml:
lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="BMI"gt; lt;!-- Flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. --gt; lt;uses-permission android:name="android.permission.INTERNET"/gt; lt;/manifestgt;
Комментарии:
1. Поделитесь своим файлом манифеста Android здесь
2.
@Suganya
Я добавил файл в свой вопрос.
Ответ №1:
Ошибка связана с именем вашего пакета, указанным в файле манифеста. Вы можете добавить имя пакета как com.bmi или так далее. Пожалуйста, обратитесь к добавленному ниже файлу манифеста из моего проекта.
lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.bmi"gt; lt;uses-permission android:name="android.permission.INTERNET" /gt; lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /gt; lt;uses-permission android:name="android.permission.WAKE_LOCK" /gt; lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:usesCleartextTraffic="true"gt; lt;activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:windowSoftInputMode="adjustResize"gt; lt;!-- 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. --gt; lt;meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" /gt; lt;!-- Displays an Android View that continues showing the launch screen Drawable until Flutter paints its first frame, then this splash screen fades out. A splash screen is useful to avoid any visual gap between the end of Android's launch screen and the painting of Flutter's first frame. --gt; lt;meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" /gt; lt;intent-filtergt; lt;action android:name="android.intent.action.MAIN" /gt; lt;category android:name="android.intent.category.LAUNCHER" /gt; lt;/intent-filtergt; lt;/activitygt; lt;meta-data android:name="io.flutter.network-policy" android:resource="@xml/network_security_config" /gt; lt;!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --gt; lt;meta-data android:name="flutterEmbedding" android:value="2" /gt; lt;/applicationgt; lt;/manifestgt;