Android ActionBar Compatibility - android

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.

Related

Resource error Xamarin.Forms (unexpected element & Ambiguity)

Suddenly having an error in my AndroidManifest
"APP.Android\obj\Debug\100\android\manifest\AndroidManifest.xml 19"
Also (Resolved - messed up with DevExpress)
Ambiguity between 'Resource.Layout' and 'Resource.Layout' "APP.Android\MainActivity.cs 25 Active"
It is working before and I didn't changed anything here:
TabLayoutResource = Resource.Layout.CustomTabbar;
Already delete the bin and obj folder and clean/rebuild the solution, but the error still exist.
Resource
AndroidManifest.xml
For the error (unexpected element queries found in manifest) in your
AndroidManifest.xml.
From document Query & Interact with Apps in Android 11 with Package Visibility, we could find that the queries element is a feature of Android 11, so you can try to update your nuget to the latest version and change your project Target Framework to Android 11 and try again.

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+

I don't know what exactly is wrong with my SDK and ADT Plugins

I was about to work on swipe tabs and upon creating a new android application project, I set the minimum required SDK in Honeycomb (3.0), my target SDK in Kitkat (4.4) and to compile it with Jellybean (4.3). Now, the first problem I encountered was I wasn't able to create a new project. I clicked the finish button but nothing happens.
As soon as I was able to create a file, I haven't typed a code but there were already several errors saying that "R cannot be resolved to a variable" I figured out it was because of the compatibility measurements so I quickly updated my SDK. Every single possible update, I updated it. I have also read that I need to update my ADT Plugins as well so I did what Murtuza Kabul said here How to update ADT. I ran my Eclipse as admin and this is the error message I got
Error when loading the SDK
Error: Error parsing
C:\adt-bundle-windows-x86-20140702\sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml
cvc-complex-type.2.4.d: Invalid content was found starting with
element 'd:skin'. No child element is expected at this point. Error:
Error parsing
C:\adt-bundle-windows-x86-20140702\sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml
cvc-complex-type.2.4.d: Invalid content was found starting with
element 'd:skin'. No child element is expected at this point.
Would somebody please give me some guidance?
ThereĀ“s a kind of problem with android wear packages for API 22, so my solution was deleting this two packages from the API 22
Now the problem is solved =)
Error: Error Parsing
C:\Android\sdk\system-images\android-22\android-wear\armeabi-v7a\devices.xml
Invalid content was found starting with element 'd:Skin'. No child
element is expected at this point.

The method getAllCellInfo() is undefined for the type TelephonyManager [Android]

Using the following code, I'm trying to get the available cell information:
import android.telephony.CellInfo;
TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService( context.TELEPHONY_SERVICE );
List<CellInfo> cellList = telephonyManager.getAllCellInfo();
Knowing that the method getAllCellInfo() and class CellInfo was introduced in API Level 17, I've set android:minSdkVersion="17" in the AndroidManifest.xml file.
However, in Eclipse I'm getting an errors stating:
The import android.telephony.CellInfo cannot be resolved and
The method getAllCellInfo() is undefined for the type TelephonyManager
I've tried cleaning, closing Eclipse and rebuilding my project, but I'm still getting these errors. I'm at a loss as to why Eclipse is not recognizing these declarations
Thanks for your help.
Edit: Permission android.permission.ACCESS_COARSE_LOCATION is also included within the AndroidManifest.xml file. But the issue still remains.
Check your project.properties file and look at the target you are building against. It should look something like this:
target=Google Inc.:Google APIs:17
This is an old project I had on hand which was building for API 17 (with Google APIs.)
You can also go into the Project properties and check the target in the UI. That setting corresponds to this file and is what Eclipse uses to build against, not the manifest. The manifest is used at runtime on the platform to know what compatibility modes to enable in the framework.

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

Categories

Resources