1

I can generate apk using assembleRelease but when I run bundleRelease it throws an error saying

Execution failed for task ':app:packageReleaseBundle'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade At most one element with namespace '' was expected, but 2 were found.

> At most one element with namespace '' was expected, but 2 were found.

  ```<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.finder"
      >

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

        <application
          android:name=".MainApplication"
          android:networkSecurityConfig="@xml/network_security_config"
          android:label="@string/app_name"
          android:icon="@mipmap/ic_launcher"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:allowBackup="false"
          android:theme="@style/AppTheme"
          android:usesCleartextTraffic="true">
          <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="finder" />   
            </intent-filter>
          
          </activity>
          <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
        </application>

        <application>
        <!-- You will only need to add this meta-data tag, but make sure it's a child of application -->
        <meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>

        <!-- You will also only need to add this uses-library tag -->
        <uses-library android:name="org.apache.http.legacy" android:required="false"/>
    </application>

    </manifest>```

1 Answers1

0

In your Manifest File, you have defined application tag two-times, but usually, an application has only one application in the manifest.

You need to replace your manifest file with this:

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
    android:name=".MainApplication"
    android:networkSecurityConfig="@xml/network_security_config"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:allowBackup="false"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true">
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="finder" />
        </intent-filter>

    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

    <!-- You will only need to add this meta-data tag, but make sure it's a child of application -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>

    <!-- You will also only need to add this uses-library tag -->
    <uses-library android:name="org.apache.http.legacy" android:required="false"/>
</application>
Muhammad Zahab
  • 1,049
  • 10
  • 21