android version condition for largeheap - android

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.

Related

attribute android:shortcutLongLabel not found

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.

How to fix "No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')"

I am getting the following error when I build my Android App project in Visual studio 2015.
No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version')
These lines are located under:
obj\Debug\android\manifest\AndroidManifest.xml
There is 3 entires of it inside the AndroidManifest file.
I have downloaded the google play service from the SDK Manager.
Should I reference anything to my solution?
I already has Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps Referenced.
Thanks.
you have create integer.xml file inside value folder and define your Integer to that place it will solve your problem.
Try doing and a clean all and check that ALL the content under the obj has been deleted and then perform a build all.
If that does not work:
I would try removing the ~GooglePlayServices~ nugets/references and re-add just the Xamarin.GooglePlayServices.Mapsnuget which will bring in the ~Basement and ~Base libraries.
You should end up with a generated manifest that only has one reference to google_play_services_version and that resource should be picked up from Debug/android/XXX/YYYYYY/ZZZZZ/R.java:
i.e.
public static final int google_play_services_version=0x7f070000;
I added several new packages. One of the package is the reason of the error. I have to check one by one and caught the one causing error. Removing that package is all I need to do to resolve the error.

First Android Project Errors

I'v just started building my first Android project with eclipse, according to Lynda's course Up and Running with PhoneGap.
When i try to run the project (like the demonstration on Lynda), i get the following error message:
"your project contains error(s), please fix them befor running your application."
Description Resource Path Location Type
error: Error: No resource found that matches the given name (at 'label' with value
'#string/app_name'). AndroidManifest.xml /android_project line 49
Android AAPT Problem error: Error: No resource found that matches the given name (at 'label'
with value '#string/app_name'). AndroidManifest.xml /android_project line 52 Android
AAPT Problem
The import org.apache.cordova cannot be resolved android_project.java
/android_project/src/com/example/android line 23 Java Problem
DroidGap cannot be resolved to a type android_project.java
/android_project/src/com/example/android line 25 Java Problem
The method onCreate(Bundle) of type android_project must override or implement a supertype
method android_project.java /android_project/src/com/example/android line 28 Java
Problem DroidGap cannot be resolved to a type android_project.java
android_project/src/com/example/android line 30 Java Problem
Config cannot be resolved android_project.java /android_project/src/com/example/android
line 32 Java Problem
Attached the error screenshot
I can guess what some of the error messages means, but i don't know how to solve them.
Any suggestion?
I'm using windows 8.
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
Thanks,
Liron
Check your strings.xml inside your project>res>values and add the string values you are going to use in your project.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="app_name">AppName</string>
</resources>
Plus, I think you need to update your .jar file of cordova.
You can download it from the phonegap github repo.
You can find the lib in the lib/android/ folder.
To create a new project, you can use the lilb/andoird/bin/create.bat file.
Don't forget to clean the project.
Hope this helps you.
I think You forgot to set the string values. I havenĀ“t read that tutorial, but there are some strings missin. Check the tutorial, You have to set some strings inside strings.xml in Your res/values folder
EDIT
go to folder inside Your project "res/values" and open strings.xml. Then begin a new line and put
<string name="example_string">This is an example!</string>
The first part "example_string" is the name of the string. This is to refer to this for example inside an xml layout. imagine You have a button in any xml layout:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/example_button"
android:text="#string/example_string"/> <-- here you refer to that string inside strings.xml
The second part "This is an example" is what will be appear on that button.
But I think it would be better if You learn the basics instead of starting with PhoneGap.
http://developer.android.com/training/basics/firstapp/index.html

Error in changing the android API level?

when i am creating new project i added API level 14 , i have completed my application and i want to change the API level to 10 ,
i am getting and error in resources-->values-v11--> style.xml
i.e error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
in resources-->values-v14--> style.xml
i.e error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
i dint understood this can any one explain
Following ankita gahoi's advice, I searched a little further and solved the problem.
Try this:
Delete the folders 'values-11' and 'values-14' (if any of them exist). Then, if this error shows up in the console window:
"No resource identifier found for attribute 'showAsAction' in package 'android'"
Read the answers to these questions:
"No resource identifier found for attribute 'showAsAction' in package 'android'" (Jason Hanley's)
How to change target build on Android project? (Alan Will's)
My build target was already set to the right Android version, so I set it to 'Google APIs' and then back to the former target.
These themes are available in API level 11 or higher so it will not work.because you are using API level 10.
refer this link-
http://developer.android.com/guide/topics/ui/themes.html
Happened to me on a specific case where one of the Android Library Projects had its reference SDK set to API 9. What got me confused was that the Error Log showed the name of the project with the correct settings, and not the problematic one.
go to values-v11--> style.xml. replace code :
<style name="LightThemeSelector" parent="android:Theme.Light">
by code :
<style name="LightThemeSelector" parent="android:Theme.Light">

no resource found that matches the given name Android 1.6

I've got 'no resource found that matches the given name' but everything is set up correctly.
error: Error: No resource found that matches the given name (at 'text' with value '#string/labReminderClear').
In AndroidManifest.xml:
<application android:label="MyName"
.....
In Strings.xml:
<string name="app_name">MyName</string>
...
<string name="labReminderClear">Clear</string>
What could be wrong?
The project you've mentiond contains errors in strings.xml file. It is connected with % sign used for example in following line (NOTE: there are multiple in that file):
<string name="msgYouHaveASTS">You have %d appointment(s)\n..and %d task(s)</string>
This is due to aapt (Android Asset Packaging Tool) becoming strict and being used for all versions of Android. See detailed explanation in this answer.
If you want to fix the code so that it works correctly, you have to add info about parameters positions. For example line from above should become:
<string name="msgYouHaveASTS">You have %1$d appointment(s)\n..and %2$d task(s)</string>
If you're using Eclipse try using (from menus above):
Project->Clean....
Select project, in which you have problem, to be rebuilt.
If that doesn't help Error Log view might help you nail what is the real issue here. From Eclipse menus choose:
Window->Show view->ErrorLog

Categories

Resources