Uploading *.aab bundle to Google play console Problem

546 Views Asked by At

enter image description hereUploading react native app bundle to Google play console for testing but it shows me : You uploaded an APK or app bundle with a shortcuts XML configuration with the following error: Element '<shortcut>' is missing a required attribute, 'android:shortcutId'. My shortcuts.xml File:

<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">

<shortcut android:shortcutId="ID_test" android:enabled="true"
android:shortcutShortLabel="@string/compose_shortcut_short_label"
android:shortcutLongLabel="@string/compose_shortcut_long_label">

<intent android:action="android.intent.action.VIEW"  
android:targetPackage="com.nativebasetest2"  
android:targetClass="com.nativebasetest2.MainActivity" />
<!-- If your shortcut is associated with multiple intents, include them
     here. The last intent in the list determines what the user sees when
     they launch this shortcut. -->
  <categories android:name="android.shortcut.conversation" />
<capability-binding android:key="actions.intent.OPEN_APP_FEATURE" />
<capability android:name="actions.intent.OPEN_APP_FEATURE">
  <intent android:action="android.intent.action.VIEW" 
      android:targetPackage="com.nativebasetest2" 
      android:targetClass="com.nativebasetest2.MainActivity">
    <extra android:key="requiredForegroundActivity" 
         android:value="com.nativebasetest2/MainActivity"/>
    </intent>
   </capability>
</shortcuts>

AndroidManifest.xml File:

 <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
android:configChanges=
     "keyboard|keyboardHidden|orientation|screenSize|uiMod"
    android:launchMode="singleTask"
    android:screenOrientation="portrait"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
        <meta-data android:name="android.app.shortcuts"
             android:resource="@xml/shortcuts" /> 
  </activity>

Please help me to find what is wrong here, TIA

3

There are 3 best solutions below

0
On

I solved it by doing change in android/build.gradle.

  1. minsdkVersion = 30
  2. taargetsdkVersion = 30
1
On

Add a reference to shortcuts.xml in your app manifest by following these steps:

  1. In your app's manifest file (AndroidManifest.xml), find an activity whose intent filters are set to the android.intent.action.MAIN action and the android.intent.category.LAUNCHER category.

  2. Add a reference to shortcuts.xml in AndroidManifest.xml using a tag in the Activity that has intent filters for both MAIN and LAUNCHER, as follows:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.myapplication">
  <application ... >
    <activity android:name="Main">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      
      <meta-data android:name="android.app.shortcuts"
                 android:resource="@xml/shortcuts" /> 
    </activity>
  </application>
</manifest>
0
On

Element '<shortcut>' is missing a required attribute, 'android:shortcutId'. is showing because the minSdkVersion must be 25.

That being said, if you still want your app to support OS below SDK 25, you can create a xml folder for SDK 25:

xml-v25 put your shortcuts file in it. xml-v25/shortcuts.xml

Edit the xml/shortcuts.xml and remove any <shortcut> tag.

Shortcuts will be available for SDK 25 and above, and your app can be installed for anything that match your minSDKVersion