AndroidManifest.xml 文件出现问题
Problem with AndroidManifest.xml file in flutter
我是 Android 开发的新手,我正尝试通过一些教程来熟悉它。目前,我坚持这个,所以你能指导我完成这个吗?当我尝试在调试中 运行 时,我的 AndroidManifest.xml 文件出现问题。我添加了下面的错误跟踪以及 xml 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ebook"
android:versionCode="1000"
android:versionName="1.0.0">
<application
android:name="${applicationName}"
android:name="android.support.multidex.MultiDexApplication"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
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. -->
<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>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
> Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'.
> Failed to query the value of property 'packageName'.
> org.xml.sax.SAXParseException; systemId: file:/C:/Users/Alberto/OneDrive/Escritorio/flutter_ebook/ebook/android/app/src/main/AndroidManifest.xml; lineNumber: 10; columnNumber: 44; El atributo "name" enlazado al espacio de nombres "http://schemas.android.com/apk/res/android" ya se ha especificado para el elemento "application".
你有两次相同的属性:
<application
android:name="${applicationName}"
android:name="android.support.multidex.MultiDexApplication"
我想你想创建 multidex 应用程序(以克服 64K 方法限制),所以你应该删除 android:name="${applicationName}"
。参见 https://developer.android.com/studio/build/multidex。
错误是你添加了重复行
android:name="${applicationName}" (A)
android:name="android.support.multidex.MultiDexApplication"(B)
如果您希望您的应用程序支持 multidex - 保留 A,让您的应用程序 class 扩展 MultiDexApplication - 然后删除 (B)
我是 Android 开发的新手,我正尝试通过一些教程来熟悉它。目前,我坚持这个,所以你能指导我完成这个吗?当我尝试在调试中 运行 时,我的 AndroidManifest.xml 文件出现问题。我添加了下面的错误跟踪以及 xml 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ebook"
android:versionCode="1000"
android:versionName="1.0.0">
<application
android:name="${applicationName}"
android:name="android.support.multidex.MultiDexApplication"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
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. -->
<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>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
> Failed to calculate the value of task ':app:generateDebugBuildConfig' property 'buildConfigPackageName'.
> Failed to query the value of property 'packageName'.
> org.xml.sax.SAXParseException; systemId: file:/C:/Users/Alberto/OneDrive/Escritorio/flutter_ebook/ebook/android/app/src/main/AndroidManifest.xml; lineNumber: 10; columnNumber: 44; El atributo "name" enlazado al espacio de nombres "http://schemas.android.com/apk/res/android" ya se ha especificado para el elemento "application".
你有两次相同的属性:
<application
android:name="${applicationName}"
android:name="android.support.multidex.MultiDexApplication"
我想你想创建 multidex 应用程序(以克服 64K 方法限制),所以你应该删除 android:name="${applicationName}"
。参见 https://developer.android.com/studio/build/multidex。
错误是你添加了重复行
android:name="${applicationName}" (A)
android:name="android.support.multidex.MultiDexApplication"(B)
如果您希望您的应用程序支持 multidex - 保留 A,让您的应用程序 class 扩展 MultiDexApplication - 然后删除 (B)