Android nor resource identifier found - android

Hi i am trying to use a Vector drawable to draw a fingerprint icon from the example xml from android dev website and i get an errior saying it cant find any of the attributes set on this drawable.
below is the code:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40.0dp"
android:height="40.0dp"
android:viewportWidth="40.0"
android:viewportHeight="40.0">
<path
android:pathData="M20.0,20.0m-20.0,0.0a20.0,20.0 0.0,1.0 1.0,40.0 0.0a20.0,20.0 0.0,1.0 1.0,-40.0 0.0"
android:fillColor="#009688"/>
<path
android:pathData="M11.2,21.41l1.63,-1.619999 4.17,4.169998 10.59,-10.589999 1.619999,1.63 -12.209999,12.209999z"
android:fillColor="#FFFFFF"/>
</vector>
My Min and compiledSdk is set to 19 :
errors i get when i try to do a clean/rebuild:
Error:(17) No resource identifier found for attribute 'viewportWidth' in package 'android'
Error:(17) No resource identifier found for attribute 'viewportHeight' in package 'android'
Error:(22) No resource identifier found for attribute 'pathData' in package 'android'
Error:(22) No resource identifier found for attribute 'fillColor' in package 'android'
Error:(25) No resource identifier found for attribute 'pathData' in package 'android'
Error:(25) No resource identifier found for attribute 'fillColor' in package 'android'

Vector drawables are available in API level 21, you cant use them in API 19
http://developer.android.com/training/material/drawables.html

As mentioned by others this is because VectorDrawables are available in API 21 and up, but you're working with API 19.
At present there is no official support for VectorDrawables for API levels before 21(well, sort of, see the final paragraph).
Here's the current situation as far as I know it. There are a couple of third party libraries available for using vectors in earlier APIs:
Mr Vector - they state that this is now no longer maintained, they are awaiting an official version for the Support library
vector-compat - they don't actually say this is no longer going to be maintained, but the last update is 7 months ago
However, there is a slightly different type of support in Android Studio for earlier APIs. This approach instead of using actual VectorDrawables in the earlier versions will instead generate PNG files to replace the Vector ones when you build your project. For this to work, make sure your Gradle Plugin is up to date(1.5.0 or above). You may also need to need increase your compile sdk version to 21 or above.

Download aapt.exe
and keep the file in the same directory in which you apktool.jar and apktool.bat files are.
Use commands java -jar apktool.jar d -s your_apk_file.apk for decompiling and java -jar apktool.jar b folder_name for compiling. Here folder_name is the name of the folder that generated after decompiling.

Related

No resource found that matches color/holo_blue_dark

I am getting this error on my android application in eclipse.
Error Msg:
Error: No resource found that matches the given name (at 'drawable' with value "#android:color/holo_blue_dark")
What does it mean and how to fix it ?
This mean that resource is not available.
#android:color/holo_blue_dark
This resource is available from the api level 11 and above, to resolve that make sure your minimum sdk level in manifest is 11+ also api level for android is also 11+

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

android - how can i use the "android:layoutDirection"?

it seems that android 4 provides "android:layoutDirection" for linearLayout and "android:textDirection" for textView , but when i choose them , i get a compilation error that it doesn't recognize them like that:
error: No resource identifier found for attribute 'layoutDirection' in package 'android'
i also can't find out more information on the internet about those attributes. what do they mean, and how come i can't use them?
It works if you change your project properties to API Level 17.
May be help u.
Note: To enable right-to-left layout features for your app, you must set supportsRtl to "true" and set targetSdkVersion to 17 or higher.
http://developer.android.com/guide/topics/resources/providing-resources.html#table2

Android ActionBar Compatibility

I was going through this sample package which Google has provided with it's sdk. I tried changing the api level to 7 and observed that there were many unresolved errors in the project.
I'm listing a few here:
ICE_CREAM_SANDWICH cannot be resolved or is not a field (ActionBarActivity.java)
R cannot be resolved to a variable (This is probably due to the fact my xml also contains errors)
SHOW_AS_ACTION_IF_ROOM cannot be resolved or is not a field (ActionBarHelperBase.java)
The method setActionView(View) is undefined for the type MenuItem (ActionBarHelperHoneycomb.java)
The method getActionBar() is undefined for the type Activity (ActionBarHelperICS.java)
The import android.view.ActionProvider cannot be resolved (SimpleMenuItem.java)
in res/values-v13/styles.xml - error: Error retrieving parent for item: No resource found that matches the given name 'android:style/
TextAppearance.Holo.Widget.ActionBar.Title'.
error: Error: No resource found that matches the given name: attr 'android:actionBarStyle'. (in res/values-v11/styles.xml)
Any idea how to get rid of these errors? Basically I'm targeting android devices 2.x and later. Does using actionbarsherlock is another alternative? I read here on some post that action bar compatibility package works on 2.x android devices as well.
Right click on your project in the Package Manager, then highlight the Android node in the Properties dialog that opens. You will see a list of Project Build Targets. Select the API level 14, Android 4.0 build target. This will get rid of the error.
Unfortunately, that also means it won't show up on your emulated devices that are using Android 2.3.3. You'll have to create a new one in the AVD that supports 4.0.
You shouldn't change the api version. The manifest declares min-sdk-version as 4, which means it will work on 2.x devices. Try loading it on the emulator, using api version 14 to compile.

android resource not found

I put this in my LinearLayout
style="?android:attr/buttonBarStyle"
but i got an error like this
No resource found that matches the
given name (at 'style' with value
'?android:attr/buttonBarStyle').
How to solve this??
which version you are using? as style="?android:attr/buttonBarStyle" is available in Android v3.0
check this for reference: http://developer.android.com/reference/android/R.attr.html
Try using style="#android:style/ButtonBar". This style is available in older version of Android, but android:attr/buttonBarStyle is available only in Android 3.0, like Zoombie has already said.

Categories

Resources