ActionBarSherlock not working in eclipse - android

I have been trying to get ActionBarSherlock ( http://www.actionbarsherlock.com ) working with my eclipse projects. I added ABS into a new project with target version 3.2, and this created fine. When I try to add this as a library to my other project (min version 2.1, target 3.2), I get errors such as
G:\EclipseWorkspace\Android\ActionBarSherlock2\res\values-v11\abs__styles.xml:65: error: Error: No resource found that matches the given name: attr 'android:windowActionModeOverlay'
basically, none of the xml attributes found in 3.0 or higher are recognised. As a consequence, R.java does not generate.
Am I doing anything wrong?

You need to compile with Android 3.2 in addition to targeting at least API 11 both in your app and for the library.
In eclipse, right click on the project and go to "Properties". Under the "Android" tab you'll need to select Android 3.2.

Eclipse is giving me strange Errors too, when implementing external libraries. What always helped for me after some tries:
try multiple times:
*rightclick on your project => Source => Clean Up
*delete and readd the library project
*restart eclipse several
you might also try to delete the generated files to force it to regenerate, but do this on your own risk :)
have fun w/ the open source libraries :)

Try upgrading the version of the sdk and target version 2.1:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
This will allow using last sdk features and the app will work on version 2.1.
Maybe, you'll see issues even after fixing this. Then you can clean the project.

Related

Unable to resolve errors on sliding menu example with actionbarsherlock

Hi I am a newbie to android and I am trying to run the Sliding Menu Example but i am getting so much errors
I have downloaded the package from here:
http://github.com/jfeinstein10/SlidingMenu/
and setup the actionbarsherlock
Also followed the instructions listed over here: http://boroniatechnologies.com/installing-slidingmenu-android-library-and-example/
and i am getting the following errors:
I am using Eclipse 22.0.0 and recent version of Android SDK
try this...
add actionbarsherlock library to slidingmenu library
in your project libraries, use only sliding menu library, not
actionbarsherlock.
delete the android support library in libs
folder in slidingmenu library, and in libs folder in your project
and clean all projects, and try it.
If you have updated SDK means,
select project->right click->go to properties->order and export>select Android Private Libraries. Click Ok.
Clean the project and run it.
The usual suspect for such errors is the minSdk/targetSdkVersion of your Android project. Try minSdkVersion of 7 and targetSdkVersion 17 (latest as of now). That is, your AndroidManifest.xml should be having this line
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17" />
And also, from project properties, set Android 4.2 (latest as of now) as the target. Project properties -> Android -> target:4.2
That should solve it. But, if you are still getting errors (on account of different versions of SlidingMenu), experiment with higher minSdkVersion.

Android library project Sliding Menu throws java.lang.NoClassDefFoundError: com.slidingmenu.lib.R$styleable

I'm developing an android application and I'm trying to use a library Sliding Menu (github.com/jfeinstein10/SlidingMenu). However, I have a problem in using the library in a clean project. I get
java.lang.NoClassDefFoundError: com.slidingmenu.lib.R$styleable
when doing
SlidingMenu slidingMenu = new SlidingMenu();
Configurations tested:
JDK tested 1.6u43, 1.7(latest)
Project target api = tried both Android 4.2.2 and Google API 17
SDK versions tested 21, 21.0.1, 21.1
Windows 8 Pro x64, Intel Core i7 3610QM, Nvidia GT660M, Samsung Pro 840 256GB SSD
Integrated both with Actionbarsherlock and without it.
I import the library, by creating an Android Project from Existing Code, marking "Is Library" in the android properties, and then referrencing it in the original application android properties (not via .jar)
Below links to code snippets, full stacktrace and screenshots of current configurations
Code snippet:
http://pastebin.com/2yzRC5AJ
Full Stacktrace:
http://pastebin.com/D7RQwuQd
I've been stuck on this for 3 days now... :/
I had to add the dependency two ways before I eradicated my noclassdef errors
Add the library.jar from /bin as dependency to your build path, make sure to select the Order and Export tab and select the check box as well for the new dependency.
Add the library via right mouse click on your project, then properties, then android then add library
Voilla
I struggled with this as well, and from a vast number of google searches, managed to piece this together.
Hope it helps..
Simple solution :
If your project already contain support library then just delete support library from library(jfeinstein10 / SlidingMenu) and then every thing works fine.you can do it after import also.
1) Just add the library to the properties of your project (ANDROID);
2) And mark the same in Order & Export property of (JAVA BUILD PATH);
I had the same problem. Since you're building the app with IDE, you need to tell the IDE that this module is a Library, thus defining the library in .properties file would be useless. Try change the IDE build file, I'm not familiar with eclipse, but in android studio this lines would be enough:
module.iml
<configuration>
<option name="LIBRARY_PROJECT" value="true" />
</configuration>
Go to Manifast and change sdkversion to 11

Phonegap 2.1 for Android - Hello World App 3 errors at launch

I developed something with Phonegap for iOS, but this is my first trial for Android.
I created my hello world application with CLI sth like this mentioned here:
$ /path/to/cordova-android/bin/create /path/to/my_new_cordova_project com.example.cordova_project_name CordovaProjectName
Even though I created this app in Eclipse Workspace, I needed to import it to Eclipse. I created two AVDs. One for API level 8, one for API level 16.
When I try to build, it gives me these three errors and a warning. What is wrong with my setup?
Description Resource Path Location Type
error: No resource identifier found for attribute 'hardwareAccelerated' in package 'android' AndroidManifest.xml /com.example.test.testprojectname line 20 Android AAPT Problem
error: No resource identifier found for attribute 'xlargeScreens' in package 'android' AndroidManifest.xml /com.example.test.testprojectname line 22 Android AAPT Problem
error: Error: String types not allowed (at 'configChanges' with value 'orientation|keyboardHidden|keyboard|screenSize|locale'). AndroidManifest.xml /com.example.test.testprojectname line 51 Android AAPT Problem
The import android.app.Activity is never used testprojectname.java /com.example.test.testprojectname/src/com/example/test line 22 Java Problem
Go to Project -> Properties -> Android and select a newer SDK (preferably the latest one), after that run Project -> Clean. That worked for me.
Check the minSdkVersion and targetSdkVersion attributes in your AndroidManifest.xml. It sounds like you're building the app for an older SDK version that didn't have the attributes that are producing the errors. Try to set both min and target to 11 and see what happens.
You should always be building for the latest SDK. It looks like your Eclipse setup is using an old version of Android (Android 2.2?). hardwareAccelerated and xlargeScreens is from Android 3.x. I recommend making sure your project uses the latest version fo the SDK in Eclipse. This has nothing to do with your Android Manifest, and is actually an eclipse setting.
By default android version is 2.1; you must right click on root folder of you project, select properties, then in android select new version; try to reload it and it wrok...
You should always be building for the latest SDK. It looks like your Eclipse setup is using an old version of Android (Android 2.2?). hardwareAccelerated and xlargeScreens is from Android 4.x. I recommend making sure your project uses the latest version of the SDK in Eclipse.
(or)
after creating your project Do the following steps
Right click your project -> properties --> change the Android target version as 4.x

Importing project gave Unable to resolve target 'android-7'

This app I completed around a year ago (!) but never launched it on the market place. I am trying to open it up in eclipse now to make some small modifications and work on the code a little bit. So I imported it and then found this weird "unable to resolve target" error. It's highlighting every class red in all my 'src' files.
I've looked at a similar question which said to add the line to default.properties file. My project has a project.properties file which has the line:
target=android-7
Any advice how to get this to work? I could always start a new project and just copy all the src files but that would be pretty lame and time-wasting.
One more comment - I'm developing on a new computer and I don't think I have the API level 7. Could that be the problem? I've gone into Window --> Android SDK Manager and the oldest available API it shows is level 8. But level 7 will mean I can target more devices I think so I'd like to go with that.
Thank you for any help.
Well, yes that is your problem. You don't have the API level 7 downloaded. You can right click the project and go properties->android and select another available API. As long as you don't change the min sdk version in your manifest you are still targeting as many devices as before.
<uses-sdk android:minSdkVersion="7"/>
Update
You don't have to do this, but you can get the older APIs on the SDK Archives page
I don't know if there is any official source for the next statement but that is what I found while working. If anybody can complete this with a better answer I would appreciate it very much.
You can compile the code with a newer SDK version as long as you don't use any code not compatible to the previous ones.
Example:
I want my app to be available for API level 7. But i only have API level 15 installed. As long as I keep the minSdkVersion="7" in my Manifest and don't use any resource not available in the previous APIs the app will work just fine on my targeted devices.
For anyone who wants to test their project against an API level that isn't the most recent one, you can just use the SDK Manager to install the old SDK:
In Eclipse (with adt installed):
SDK Manager:
Just check the box of the SDK you want to use to test against your project and click install. You can also remove API's that you aren't using.
Right click on your project then:
Properties -> Android -> Project build target -> Check Android 4.1.2
In your application's manifest.xml file add this tag
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
It's worked for me. Try it.
I resolved this issue by editing my project.properties file
from: target=android-7
to: target=android-19.
I also changed the target sdk version in the manifest file:
android:targetSdkVersion="19".
Yes. I see the same problem when I import the android support v7 project as a library project in my own project,the eclipse says that cannot resolve android16, I find that it's the problem of the eclipse,you can right-click your project which has this problem,and then select properties,the Android pane,there is a Project Build Target pane there,you can see it easily,choose a standard android platform,like Android4.3,not others that start with Google API,I hope that this will help you!
check android:minSdkVersion= in the AndroidManifest.xml
update target=android- in the project.properties if you use Eclipse IDE

Third party library troubles on LayerType attribute even after building it on Android 3.2

So, I coded my entire app in Android 4.0.3. I used AmbilWarna color picker. Then I got this requirement to reduce the SDK requirement for Android 2.3. This is the point when EVERYTHING was working fine and superb
I have downgraded teh minimum SDK requirement. Everything runs fine except as soon as I include Ambil Warna as a library on my project, I start getting the error everywhere R is used, Saying that R cannot be resolved to a variable.
Upon a loot on the Console, this is what seems to be the real cause of the problem:
AmbilWarna\res\layout\ambilwarna_dialog.xml:18: error: No resource identifier found for attribute 'layerType' in package 'android'
I have set the Android SDK to 3.2 for AmbilWarna library project and on my project its at 2.3
Does anyone have any idea?
this is regarding this: http://developer.android.com/reference/android/view/View.html#attr_android:layerType
you are just trying to use a property for android that is not available on that api of the layout parser.
I just checked out the colorpicker code you are trying to use, and it's project.properties says it's written for target API-17 (android 4.2) and i'm tryng to compile it for API-10 (android 2.3.3)
simply remove those parts.
my diff
--- a/AmbilWarna/res/layout/ambilwarna_dialog.xml
+++ b/AmbilWarna/res/layout/ambilwarna_dialog.xml
## -19,7 +19,7 ##
android:id="#+id/ambilwarna_viewSatBri"
android:layout_width="#dimen/ambilwarna_hsvWidth"
android:layout_height="#dimen/ambilwarna_hsvHeight"
- android:layerType="software" />
+ />
and hope it's not mentioned in the code :)
I've had a lot of troubles too with my external libraries. What usually helped are one of these or multiple steps of these connected:
Delete ALL R.java imports in your Classes (there must not be any of them)
In Eclipse: Source => "Clean Up"
In Eclipse: Project => "Clean..." (This will rebuild your project from scratch and therefore regenerate your R.java)
Manually delete all R.java and save (located in /gen/)
Delete your external library project and readd it.
Step 3 usually did the job for me.
Also be aware that your minSdkVersion and targetSdkVersion fit to your library project (and the guidelines which are included)
I had the same problem, I thought I could just build and include the third party jar file and bring this over to my project - this resulted in the same problem as you - AmbilWarna\res\layout\ambilwarna_dialog.xml error: No resource identifier found for attribute 'layerType'.
To fix it I copied over the source files and all resources into my project (images/layouts etc etc), hey presto it worked.
Thanks http://code.google.com/p/android-color-picker/ for a nice clean easy to use colour picker!!

Categories

Resources