Uploading 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
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
Add a reference to shortcuts.xml in your app manifest by following these steps:
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.
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>
I solved it by doing change in android/build.gradle.
minsdkVersion = 30
taargetsdkVersion = 30
Related
I do have a problem with my current flutter project. My project was already built in release and also I put also the correct keystore file and the targetsdkversion. Now, when I am uploading my app in the playstore it always shows android exported property set (which as I was already know how to solve it.) I set all the receivers and tags that uses intent-filter to android:exported' true or false. Now, the problem is when I upload it to playstore it still showing the android exported error. I tried to migrate it to android studio in order to modify the merged manifest but I am unable to do so because I doesn't show the merged manifest. I also tried to manually edit the one on the app/build/intermediates/merged_manifest folder but still same results. I am using latest flutter with dart for it. Any more tips for me to fix? Attached also here is my manifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jerrybuyer.app" xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
<application
android:label="Jerry App"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher" tools:node="merge">
<activity
android:name=".MainActivity"
android:exported="true"
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. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<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" />
<!-- facebook configs -->
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="#string/facebook_client_token"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" android:exported="true"/>
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<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="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application>
</manifest>
PS: I have now managed to unlock my merged manifest but even though I saw the merged manifest file, it doesnt show any intent-filter that needs an android exported
Here is the screenshot of the android merged-manifest that I managed to show. It doesn't show any errors regarding the intent-filter android:exported
First of all I read the other solution attempts on here but their fixes don't work for me for some reason.
My shortcut XML looks like this:
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="#drawable/ic_shortcut_tinted"
android:shortcutId="shortcut"
android:shortcutLongLabel="#string/shortcut_longLabel"
android:shortcutShortLabel="#string/shortcut_shortLabel"
android:shortcutDisabledMessage="#string/shortcut_disabledMessage">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="de.example.exampleApp.exampleClass"
android:targetPackage="de.example.exampleApp" />
<categories android:name= "android.shortcut.example" />
</shortcut>
</shortcuts>
My relevant code in the AndroidManifest file looks like this:
<activity
android:name=".common.ui.activities.MainActivity"
android:exported="true">
<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>
I made sure that in my build.gradle the ApplicationId is de.example.exampleApp
I have no clue what else to do. If it is relevant in any way I test my app on the Genymotion Emulator instead of a real device.
Okay as it seems I overlooked the information that you can only make shortcuts to Activities (e.g. android:targetClass has to be an Activity)
As a solution I used a kind of hacky(?) solution which you can see here
I'm facing the following error:
Error while executing: am start -n
"com.package/com.package.SplashActivity" -a android.intent.action.MAIN
-c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.package/.SplashActivity
} Error type 3 Error: Activity class
{com.package/com.package.SplashActivity} does not exist. Error
while Launching activity
So what can I do to resolve this issue
Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.company.xyz">
<application
android:name="GoogleAnalyticsApp"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#style/MyMaterialTheme">
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait">
<!-- For Pushwoosh we have to set following code: -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name=".MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
</application>
</manifest>
I have added Manifest file also in that you can see what I need to change and I am using push for notification.
Thanks for the help in advance.
Edited : com.company.xyz packagename which is same in other build.gradle and manifest
I have checked both files are having same package name and the application is running in all device but when i try to run it on OREO it not launching activity.
OP, Have you found a solution for this?
I had the same issue using a splash screen in android o. It was caused by the custom theme I was using before O. Are you using a custom theme for that activity?
If so, this solution might help you.
The custom theme had this code
<item name="android:windowBackground">#drawable/background_splash</item>
but android O seems to crash with it so try this solution that I used to solve my issue
Create a new value-v26/styles.xml then add the code below in that xml
<style name="Splashscreen" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowSplashscreenContent">#drawable/splashscreen</item>
Replace the background drawable with your own.
The full detail of the solution is from this post by Omkar Amberkar
make sure in android manifest file in your SplashActivity is call first like below code..
<activity
android:name=".activity.SplashActivity"><!--activity is package name. hear pass your first activity to load app start-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Activity class {com.package/com.package.SplashActivity} does not exist.
I think the activity class package name or the manifest declaration along with the fully specified package name is missing in your case.
I have been looking into building a app to replace the homescreen on android, I need to know how to add the option to add app shortcut to my app.
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.
Add a <meta-data> element to this activity that references the resource file where the app's shortcuts are defined:
<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>
You can find the rest here - https://developer.android.com/guide/topics/ui/shortcuts.html
Hope this helps!
My manifest file is as below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo.myglassapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.demo.myglassapp.MainActivity"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger_start" />
</service>
</application>
</manifest>
voice trigger start file
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="#string/its_demo" />
My strings.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">myglassapp</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="its_demo">Hello Sir</string>
</resources>
As per my knowledge I have added a code block
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />
in manifest file. I created a voice trigger file and set a variable in it.
Now i call that variable from strings.xml file.
So, basically it is all correct but i do not see "Hello Sir" added to my OK GLASS menu.
When I run my application from Eclipse IDE, i do not see my menu after OK GLASS menu option.
In stead, I see my app directly running like it runs in Android phone when we set it in debug mode.
Any idea why it is not working?
I agree with Nicole. Maybe if you move some stuff around it may work. But, it depends a lot on how you are building your app. In my case, for example, the voice trigger intent is define for my activity, not my service (Similar to Nicole's case). However, I have seen some examples where the trigger is on the service. You can check those examples by creating a sample Android project in Eclipse.
Now, the reason why your app is opening after you run it similarly to a mobile is because you have this on your manifest
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You should remove that if you dont want that behavior
In your glass itself you say your application name it will show the list of app
Try this Hope this will help
I am new to glassware development.. but maybe try moving some things inside your application tag in manifest (instead of the service tag.. I do not have a service tag at all). Here's an example of my manifest file that works with voice recognition from the start menu...
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger_start" />
</activity>
</application>`