Error importing HoloEverywhere - android

First of all, I am new with Android.
I am doing an app, and I am implementing a library called HoloEverywhere.
This library use in the themes.xml the library ActionBar Sherlock. I have imported to my workspace ActionBar Sherlock and I have added it to HoloEverywhere.
Next, I have added HoloEverywhere to my project, but when I try to use it, I have an error (I tried to use a button):
The following classes could not be instantiated:
- com.WazaBe.HoloEverywhere.ButtonHolo (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse.
I put the path of the class in my layout, like this:
<com.WazaBe.HoloEverywhere.ButtonHolo
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/text" />
How I can solve this problem and use this library in my project?. Thanks :)
PS. Sorry for my english, I know it is not very good.

Follow the steps below(taken from blog here) to add ActionBarSherlock
Download the .zip/.tgz and extract it
Go to eclipse and choose File->New-> Android Project
Select Create project from existing source and then browse to the library folder inside extracted AndroidBarSherlock folder
Build Target should be the latest(14 or15), but your minSdkVersion can be less (7 or 8)
Press Finish
Right click on the newly created project and go to Properties.
Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked.
Right click -> Properies on the project in which you wish to add AndroidBarSherlock under the Android heading and the Library section choose Add.
You should see the ActionBarSherlock library, add this to your project
Lastly, if you were using the compatibility support , you need to delete that jar since it's included in ActionBarSherlock.
Follow the steps below to add HoloEverywhere
Download Zip from GitHub to your computer
UnZip the folder
Go to eclipse and choose File->New-> Android Project
Select Create project from existing source and then browse to the HoloEverywhereLib folder inside extracted folder
Press Finish
Right click on the newly created project and go to Properties.
Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked and press Add and previously added library ActionBarSherlock.
Follow these steps to add HoloEverywhere to your project
Create a new Android project
Right Click on project -> Properties -> Android -> Add, add both ActionBarSherlock and HoloEverywhere
Change the Android Manifest to following
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Holo.Theme">
Edit you main.xml to include Holo theme widgets.
Change your activity as follows
public class ChkActionBarSherlock extends SherlockActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

It seems that
android:theme="#style/Theme.HoloEverywhereDark.Sherlock"
cause an error.
change it:
android:theme="#style/Holo.Theme"
resons here:
Github
correct!

I had the same error on my project, This is what I did, right click the HoloEverywhere (properties->android->library) remove the ActionBarSherlock from the list then re-add the ActionBarSherlock project by click add, after that clean up the project and all errors will disappear.

The creator of ActionBarSherlock, Jake Wharton, announced on Google+ that further development of ActionBarSherlock has been stopped. ActionBarSherlock 4.4 is the last release and might get bug fixes – but there won’t be any new features:
While there may be a dot release or two in the coming weeks, version
4.4 is shaping up to be The Last Release™.
https://plus.google.com/+JakeWharton/posts/F3HkWY9J8fK
As i asked on holoeverywhere issues forum and answered by devs:
HoloEverywhere doesn't have any dependency with ABS since v2.0
So you should not use ABS anymore and remove the library from your project and replace it holoeverywhere directly or with ActionbarCompat from google support library.

Related

SherlockActivity cannot be resolved to a type when update the latest sherlock library in android?

when I use sherlock library 4.2.0.0 in my android apps my apps working fine and update the sherlock library with 4.4.0.0 then my apps working fine but when upgrade eclipse and android sdk then got error "SherlockActivity cannot be resolved to a type" and other classes and methods of sherlock giving a same error "--- cannot be resolved to a type" .
When i upgrade my eclipse i saw some changes in folder structure and showing error under
"Android Private Libraries" folder like "missing" something.
some people suggest me delete the android-support-v4.jar from libs because this already present in "Android Private Libraries" then i deleted. when the build the all android projects then I got error "error while execute aapt.exe" on popup . I don't know why this
happen.
Que.1 is there any file missing while i am updating eclipse.
I did add library like a,
create new android project -> make it library without creating activity -> after that ->
import the sherlock library into that project.
and add this library to the my android apps
project properties -> add sherlock libary
I am also upgrade eclipse and sdk. I tried lot of way to add the sherlock library but not added yet. please suggest me some solution because i want to deploy my apps.
I had a problem with Sherlock and it was Compiler compliance setting that I had to set to 1.6.
Try with Right click on you project -> Properties -> Java Compiler -> Compiler compliance level and set 1.6

How to resolve the error "No resource found that matches the given name" when adding library v7 AppCompat in Eclipse?

I have a project target to API Level 10 and i want to implement the new ActionBar support library.
After follow all the instrutions in the Support Library Setup, when adding the library to my project I came across with dozens of error messages like this:
android-support-v7-appcompat\res\values-v14\styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.....
OK, i know that they are many answers to this question, but, after trying all the more obvious, i still could not solve the error.
I kept searching and found the cause, which is not so obvious, at least for newbies like me.
My intent is provide a full answer to help all those who are like me and do not master all the secrets of the Android development.
This is what you have to do for use the ActionBar support library correctly.
Follow the instructions in the Support Library Setup - Adding libraries with resources.
One thing that can bring some doubt is add the library to your aplicattion project:
(1) In the Project Explorer, right-click your project and select Properties.
(2) At the left pane select Android.
(3) At th bottom of the right pane click Add
(4) Select the library project android-support-v7-appcompat and click OK.
Click OK to close the properties window.
If you not get any of the errors I mentioned it´s all done.
However if you are like me, you dont´t followed the advice of Android team that suggests you always compile your source using the latest SDK, you get the error.
The error ocurrs because my Project Build Target was Android 2.3.3 and need to be at lest 3.0.
It was not immediately clear to me because of the fact that I'm specifically developing for Android 2.3.3 and I'm using support libraries.
OK, I hope this helps.
You should add that support library to your project. To add:
Right click on project, then go to :
properties > Java Build Path > Libraries
here Add External JARs...
add android-support-v7-appcompat.jar (path/to/sdk/extras\android\support\v7\appcompat\libs)
Additionally you also have to copy that jar to libs folder of your project, if it is not there automatically.
and you should use the #style/Theme.AppCompat theme for your application for support-v7 to be working
also keep one thing in mind you should change min sdk version to 11 if you want to support("android:windowActionBar")property in your project.

Importing ActionBarSherlock - android

I am new to Android, and I am setting up a project which needs ActionBarSherlock. I imported the last one as module inside my project so that the error warning import com.actionbarsherlock.app.ActionBar; which was entirely red, is now getting red only on ActionBar. How can I manage this ? Do I have to put ActionBarSherlock in my project lib folder rather than imported it as a module
So you have ABS library module in hand. Now, I'll tell from starting
Start a new project. Make compile with latest (jelly bean) and Theme as None.
In project explorer, navigate to libs folder and delete supportv4 jar file.
Now, include your ABS library following properties-->Android-->library
finally, change theme as,
< application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
a priori, I manage to do the trick, by importing ActionBarSherlock as module. Then, I stll got an error upon ActionBar in com.actionbarsherlock.app.ActionBar. In my code, I edited the help warning popup box showing optimizing imports and adding as dependecy module , and clicked on the latest, and it worked fine
Go to file-->import-->Android-existing code into workplace, Then select ActionBarSherlock's Library, After importing go to the properties of the project in which you wanna add actionBar.
Do this by right clicking on your project in package explorer -->properties--> under Android click add in the library section and choose the actionBarsherlock lilbrary listed there.
EDIT:
I would suggest you look here. Make sure that you have checked is library option. But what I think initially is that the library is added perfectly since its now recognising com.actionbarsherlock.app package. One common bug is that actionbarsherlock and your project both contains the android support package library, try deleting the android support library from your project since your project should be using the support library from actionbarsherlock. Remember to backup your code.
EDIT 2: You should be extending sherlockActivity instead of normal activity, same stands for Fragments, A fragment would be changed to sherlockFragment. These are the widgets that will come from sherlock library.
Refer this link also

Adding source files to android

Ok, i've wasted an hour trying to figure it out, even though it's something really simple.
I've downloaded some code from github. I'd like to use this in my android application. How do I go about adding it? It's not a jar file, and i tried drag dropping it and linking the files, and it didn't work. Importing and refreshing / cleaning the project didn't work.
I'm not sure where I'm going wrong. Any help is greatly appreciated!
If this is a project you want to import in eclipse, right click on eclipse left pane (the project list), import, android project from files, select the repository folder.
If this is a library you want to use in you app, there is another step : go to the properties of your project, android tab and in the library section click on add, then select the library project.
By design, android code that contains layout resources (for example ActionBar Sherlock) can not be embedded in a jar. So you have to use it as a library project. It is very convenient though, since it allows you to look at or modify the library code very quickly.
You may also need to let Eclipse know that your library project is a library and not an app. To do so, in the same Properties/Android screen you just have to check the "is a library" checkbox.
Reference on that topic : official documentation
In Eclipse:
File->New->Other->"Android Project from exiting Code"

Action bar implementation with ActionbarSherlock

I am using ActionBarSherlock to implement action bar on my Android 2.1 API 7 project. (With Eclipse IDE)
In order to use sherlock, after I imported sherlock library as a existing project on Eclipse. I did the following things on my own project:
mouse right click on my project, choose "properties"
in "Android" section, there is "Library" sub-section, I added sherlock project as library
Apply change
Then, I notice the FragmentActivity can not be resolved in my project source code.
I checked the project property again, the added sherlock project as library is not in "Library" section...weired!!! Why it suddenly disappeared even I have added sherlock as library? What am I missing?
I mean no matter how many times I added sherlock as library to my own project, the next time I check project property, the sherlock just disappear from library section...
First, after adding the project as a library, restart Eclipse - I believe this is a known bug with at least some versions of the plugin.
If that doesn't work, check that the 'default.properties' file in your project root is not read only.
Other known problems :
Your app should use the same "Uses-sdk" setting in AndroidManifest like your Sherlock addon
Minimum Java version for Sherlock: 1.6 !
In package with libraries, you also have a lot of samples with source code
ActionBar is not visible in Layouts
Few simple that i remember

Categories

Resources