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
Related
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.
I have imported the sample for "Google Plus " from extras and I am facing the issue while building the project.
Could you please assist me to resolve this ?
android:configChanges="screenSize|smallestScreenSize"
These attributes were introduced in API level 13, so make sure your minSdkVersion is equal to 13 or higher. The same applies to your compileSdkVersion.
See also: Error string types not allowed at android:configChanges in manifest file
I'm trying to make my app use the Holo Light theme if it is running on a 3.0+ device, but for some reason the values-v11 method isn't working. I see a bunch of other people apparently using this method, but when I define my theme in res/values-v11/themes.xml:
<resources>
<style name="MainStyle" parent="#android:Theme.Holo.Light">
</style>
</resources>
Eclipse gives me error: Error retrieving parent for item: No resource found that matches the given name '#android:Theme.Holo.Light'. It's the same whether I use android:Theme.Holo.Light or android:style/Theme.Holo.Light.
My minSdkVersion is set to 10 and my targetSdkVersion is set to 15.
Any ideas?
I suspect you should be using parent="#android:style/Theme.Holo.Light". Make sure it's exactly like this--with the # sign and everything.
From comments: Also make sure you've set your target API (different from the target SDK) in the Project Properties (not the manifest) to be at least 4.0/API 14.
Set your Project Build Target above or equal to 14 and make sure you used correct syntax for Theme.Holo.Light.
It should be like this
parent="#android:style/Theme.Holo.Light"
TextAppearance.Holo.Widget.ActionBar.Title appears to have been added in API Level 13. Make sure your build target is set to 13, not just 11.
AndroidManifest.xml:
<uses-sdk
android:minSdkVersion=...
android:targetSdkVersion="11" />
I imported android project an I got 3 errors
error: Error: String types not allowed (at 'screenOrientation' with value 'sensorPortait'). AndroidManifest.xml /com.cartmillimaging.fishingmate.MapViewActivity line 16 Android AAPT Problem
same error on different lines.
<activity android:name=".MapViewActivity" android:screenOrientation="sensorPortait">
For project build target I have selected Google APIs 2.3.3. 10.
I also enabled Java compiler project specific settings and put compiler compliance error to 1.6.
I am new to android development, so can you help me?
checkout your API level. The following attributes:
android:screenOrientation="sensorPortrait" only can work on API level 16+
android:screenOrientation="sensorPortait" can work under level 15
I think it's a fixed bug
There's a typo error in the value. The correct name is "sensorPortrait"
when you load project I get this error (I use api level 10). I found solution for this. You change screenOrientation to something else, save it, and then return to sensorPortait and everything now is working.
Confirmed what cashmere said.
i changed all
android:screenOrientation="sensorPortrait"
to
android:screenOrientation="sensorLandscape"
built the project and then changed it back again for all my activites in the manifest and all works good :)
Had this error and couldn't kick it. Some how my build settings had API 13 selected... Selected API 21 and yay no more issue!
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.