簡體   English   中英

將 *.aab 包上傳到 Google Play 控制台問題

[英]Uploading *.aab bundle to Google play console Problem

在此處輸入圖片說明 將 react native app bundle 上傳到 Google Play 控制台進行測試,但它向我顯示:您上傳了帶有快捷方式 XML 配置的 APK 或應用程序包,但出現以下錯誤:元素“<shortcut>”缺少必需屬性“android:shortcutId” . 我的快捷方式.xml文件:

<?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 文件:

 <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>

請幫我找出這里有什么問題,TIA

按照以下步驟在您的應用清單中添加對快捷方式.xml 的引用:

  1. 在您應用的清單文件 (AndroidManifest.xml) 中,找到其意圖過濾器設置為 android.intent.action.MAIN 操作和 android.intent.category.LAUNCHER 類別的活動。

  2. 使用 Activity 中具有 MAIN 和 LAUNCHER 意圖過濾器的標記,在 AndroidManifest.xml 中添加對快捷方式.xml 的引用,如下所示:

<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>

我通過在 android/build.gradle 中進行更改來解決它。

  1. minsdkVersion = 30
  2. 目標 dk 版本 = 30

Element '<shortcut>' is missing a required attribute, 'android:shortcutId'. 顯示是因為 minSdkVersion 必須是 25。

話雖如此,如果您仍然希望您的應用支持 SDK 25 以下的操作系統,您可以為 SDK 25 創建一個 xml 文件夾:

xml-v25將您的快捷方式文件放入其中。 xml-v25/shortcuts.xml

編輯xml/shortcuts.xml並刪除任何<shortcut>標記。

快捷方式將適用於 SDK 25 及更高版本,並且您的應用程序可以安裝到與您的 minSDKVersion 匹配的任何內容

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM