attribute android:shortcutLongLabel not found - android

Trying to test my android shortcuts but I keep getting an error stating that attribute android:shortcutLongLabel not found, and this continues with shorcutShortLabel, shortcutID, etc. Shouldn't make a difference but I am writing the app in kotlin, and am using compileSdkVersion 29.
Trying to add app shortcuts to my project. So I created the shortcuts.xml file and added it to res/xml/shortcuts.xml. I've made sure everything in Gradle was up to date, and have followed Google's documentation down to the dot on adding shortcuts in your app. I assume there is something wrong with either my Gradle or manifest.xml but I don't know what. Also when I hit F2 it says no errors found on this file.
<?xml version="1.0" encoding=utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut android:enable="true"
android:shortcutID="xxxx"
android:icon="#drawable/xxxxx"
android:shortcutShortLabel="#string/xxxx"
android:shortcutLongLabel="#string/xxxxx">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.example.test"
android:targetClass="com.example.test.TestIntent/>
</shortcut>
Every time the following happens when I build my project:
AAPT: error: attribute android:shortcutLongLabel not found. AAPT:
error: attribute android:shortcutShortLabel not found. AAPT: error:
attribute android:shortcutID not found.

Related

android version condition for largeheap

I'm trying to use largeheap: true in the AndroidManifest file, and I found this answer
Enable android:largeHeap in Android 4, and disable it in Android 2.3
but the problem is I always get the errors
/*/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:38:28-41: AAPT: No resource found that matches the given name (at 'largeHeap' with value '#values/bools').
/*/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml:32: error: Error: No resource found that matches the given name (at 'largeHeap' with value '#values/bools').
I created 2 files bools.xml
first one in */android/app/src/main/res/values/bools.xml
with value <bool name="largeheap">true</bool>
and the 2nd one in */android/app/src/main/res/values-v23/bools.xml with value <bool name="largeheap">false</bool> (for api 23 and above)
not sure what I am missing, why the AndroidManifest won't find the resource to match the line android:largeHeap="#bool/largeheap"
is there anything else I need to do beside the android:largeHeap="#bool/largeheap" in the AndroidManifest file ?
thanks.
According to your error, I can see that android complains about #values/bools and your question is showing another line: android:largeHeap="#bool/largeheap".
I created a new app project and reproduced your case. This worked for me:
Use this in AndroidManifest.xml:
android:largeHeap="#bool/largeheap"
And make sure your bools.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="largeheap">true</bool>
</resources>
Also try to clean and rebuild your project after that.

Implementing managed configurations in NativeScript

I am developing a NativeScript app for android and wish to implement managed configurations as described here: https://developer.android.com/work/managed-configurations.html.
I have tried adding app_restrictions.xml to the App_Resources/Android/values folder but I get the following build error:
Execution failed for task ':mergeF0F1DebugResources'.
Error: Unsupported type 'restriction'
This is the content of app_restrictions.xml:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="downloadOnCellular"
android:restrictionType="bool"
android:defaultValue="true" />
</restrictions>
Does NativeScript support adding restrictions like this? If so, how do I add the restriction resource file. If not, is there some other way to implement managed configurations?
EDIT: Solved by pkanev in the comments. The restrictions file must be placed in App_Resources/Android/xml.
Per the official Android documentation - https://developer.android.com/work/managed-configurations.html
the restrictions configuration needs to be placed in res/xml dir, which corresponds to app/App_Resources/Android/xml in a NativeScript Android app.

Issue: Implementing app restrictions and Lint Errors in app_restrictions.xml

I am working on Android MDM and have the app_restrictions.xml file under /src/main/res/xml/ folder. The MDM I am using is not showing me the value of the restriction, not even the default value. All the steps mentioned in this link has been followed to set app restrictions: https://developer.android.com/training/enterprise/app-restrictions.html
but i am getting Bundle[EMPTY_PARCEL]. below is the code
app_restrictions.xml
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="MDMEmailKey"
android:title="Email"
android:restrictionType="string"
android:description="#string/email_address_mdm_description"
android:defaultValue="testtesttest#gmail.com" />
<restriction/>
</restrictions>
Also, the lint is showing me below errors, though I was able to suppress it in gradle through lint options, but just wondering if it is not the cause of the issue I am facing. Please let me know why I am getting these errors.
Executing task ':project_name:lintVitalRelease' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
.../src/main/res/xml/app_restrictions.xml:8: Error: Missing required attribute android:key [ValidRestrictions]
<restriction/>
~~~~~~~~~~~~~~
.../src/main/res/xml/app_restrictions.xml:8: Error: Missing required attribute android:restrictionType [ValidRestrictions]
<restriction/>
~~~~~~~~~~~~~~
.../src/main/res/xml/app_restrictions.xml:8: Error: Missing required attribute android:title [ValidRestrictions]
<restriction/>
~~~~~~~~~~~~~~
Explanation for issues of type "ValidRestrictions":
Ensures that an applications restrictions XML file is properly formed
https://developer.android.com/reference/android/content/RestrictionsManager.html
3 errors, 0 warnings
RE: The lint errors
You have an empty restriction element at line 8 <restriction/>
Just remove it and the lint errors will go away.
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="MDMEmailKey"
android:title="Email"
android:restrictionType="string"
android:description="#string/email_address_mdm_description"
android:defaultValue="testtesttest#gmail.com" />
<restriction/> <!-- Error here -->
</restrictions>

android studio Execution failed for task ':app:mergeDebugResources'

I decompiled an app using an online tool (www.decompileandroid.com) then, after I downloaded the zipped source code (assets + java code), I extracted it in a folder and finally I imported the folder in android studio (File>New>Import Project).
Then, without editing any file, I tried to run the project but I got this error:
Error: Found item ###/ITEM-NAME more than one time
Error:Execution failed for task ':app:mergeDebugResources'. > C:\Users\Fabrizio\AndroidStudioProjects\com.hwlogos.ytstars\app\src\main\res\values\public.xml: Error: Found item ###/ITEM.NAME more than one time
I searched the web for hours but I can't find any useful answer...
Please help!
PS: I tried also with other applications but I always get the same error...
UPDATE:
Now I tried to decompile a simple app i created with android studio and when I reimported it in android studio I got the same error.
it seems there are two resources with the same name, one declared as string and the other as id.
Here's a part of my public.xml, which i never wrote when I made my application!!!
<public type="string" name="action_settings" id="0x7f070006" />
<public type="id" name="action_settings" id="0x7f09000a" />
Create a new xml ids.xml in values with all the id values which are to be constant.
<resources>
<item type="id" name="index_row_search" />
</resources>
I think its better if you copy the resource ids to public.xml from the R.java, the first time to avoid errors like entry index is larger than available symbols and also to keep the type of resource to be consistent.
visit here for more help How to add id to public.xml?

where is AndroidManifest in unity 5?

Salaam
I want to build my scene for android in unity 5, but i get a huge error.\n
a part of this error:
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
.
.
.
AndroidManifest.xml:4: error: No resource identifier found for attribute 'isGame' in package 'android'
where is AndroidManifest to remove attribute 'isGame'?
Go to Search and type AndroidManifest ScreenShot, open with Monodeveloper and edit android:targetSdkVersion="type your version"
I found a way to solve the problem.
Just update android-sdk to version 23

Categories

Resources