thinkcode
thinkcode

Reputation: 348

Unable to create preview of the app actions used in the app in google assistant

I have added the shortcuts.xml in res/xml and also added the

<meta-data
   android:name="android.app.shortcuts"
   android:resource="@xml/shortcuts" />

in the AndroidManifest.xml and also uploaded the signed bundle file in the play console internal testing.

But I'm getting the below error while creating the preview using the google assistant app actions test tool in android studio

Google Assistant plugin v2.3.0
                Preview Creation Error
                
                Status Code: 400
                Message: Precondition check failed.
                
                - Please sign in to Play Console (https://play.google.com/apps/publish) and check if you have accepted the latest Terms of Service (ToS), and the Gmail/G-Suite account has the authorization to modify the app with package name 'uninitialized.application.id'.

Upvotes: 2

Views: 1050

Answers (2)

DrZaphod
DrZaphod

Reputation: 511

I found that I had to add the meta-data tag in multiple places, if your using the standard shortcuts.xml like this:

<meta-data
   android:name="android.app.shortcuts"
   android:resource="@xml/shortcuts" />

I had to add this to the first block even though it was also included it in the block that was receiving the intents.

Fuller example:

<application ...>
  <activity android:name=".MainActivityOfApp" exported="true">
    <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
      <action android:name="android.intent.action.VIEW" />
    </intent-filter>

    <meta-data
     android:name="android.app.shortcuts"
     android:resource="@xml/shortcuts" />
  </activity>

  <activity android:name=".ActivityForReceivingActions" exported="true">
    <intent-filter>
      <action android:name="android.intent.action.VIEW" />
    </intent-filter>

    <meta-data
     android:name="android.app.shortcuts"
     android:resource="@xml/shortcuts" />
  </activity>

Upvotes: 0

Prisoner
Prisoner

Reputation: 50701

The part of the error message that reads

modify the app with package name 'uninitialized.application.id'

seems particularly strange. There are a few things I would make sure about:

  • Make sure your app/build.gradle has the correct applicationId in the defaultConfig section and that you use this Id elsewhere.
  • Make sure that was the version that you uploaded.
  • Ensure that the account that you used for the play store is the same account that you're using to for the test tool.
  • This issue suggests that a default applicationId may have been assigned and set in the merged manifest, and that you can just rebuild the entire project once you have it correctly set in app/build.gradle

Upvotes: 1

Related Questions