I'm new to Android development, and I am trying to get familiar with it with some tutorials. Currently, I am stuck with this so could you please guide me through this? I have an issue with my AndroidManifest.xml file when I try to run it in debug. I added the trace of the error below along with the xml file
<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".
CodePudding user response:
You have the same attribute two times:
<application
android:name="${applicationName}"
android:name="android.support.multidex.MultiDexApplication"
I suppose you want to create multidex application (to overcome 64K methods limit), so you should remove android:name="${applicationName}"
. See https://developer.android.com/studio/build/multidex.
CodePudding user response:
Mistake is you added duplication line
android:name="${applicationName}" (A)
android:name="android.support.multidex.MultiDexApplication"(B)
if you want your app support multidex - Keep A, let yourApplication class extend MultiDexApplication - then remove (B)