14

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.

peetsnack
  • 91
  • 10
Alexrs95
  • 392
  • 1
  • 3
  • 13
  • Hello, I am Christophe (or Waza_be) and this is the first time I have seen such an error! If I found something, I will come and answer you! – Waza_Be Jun 04 '12 at 20:55
  • i do up steps but i get this error on pom.xml file : Multiple annotations found at this line: - Failure to transfer org.apache.maven.plugins:maven-enforcer-plugin:pom:1.0 from http:// repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-enforcer-plugin:pom:1.0 from/to central (http://repo.maven.apache.org/ maven2): The operation was cancelled. - Project build error: Unresolveable build extension: Plugin – mahdi Feb 05 '13 at 20:01
  • http://stackoverflow.com/a/20895081/623694 – Mehdi Fanai Jan 03 '14 at 01:36

4 Answers4

40

Follow the steps below(taken from blog here) to add ActionBarSherlock

  1. Download the .zip/.tgz and extract it
  2. Go to eclipse and choose File->New-> Android Project
  3. Select Create project from existing source and then browse to the library folder inside extracted AndroidBarSherlock folder
  4. Build Target should be the latest(14 or15), but your minSdkVersion can be less (7 or 8)
  5. Press Finish
  6. Right click on the newly created project and go to Properties.
  7. Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked.
  8. Right click -> Properies on the project in which you wish to add AndroidBarSherlock under the Android heading and the Library section choose Add.
  9. You should see the ActionBarSherlock library, add this to your project
  10. 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

  1. Download Zip from GitHub to your computer
  2. UnZip the folder
  3. Go to eclipse and choose File->New-> Android Project
  4. Select Create project from existing source and then browse to the HoloEverywhereLib folder inside extracted folder
  5. Press Finish
  6. Right click on the newly created project and go to Properties.
  7. 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

  1. Create a new Android project
  2. Right Click on project -> Properties -> Android -> Add, add both ActionBarSherlock and HoloEverywhere
  3. Change the Android Manifest to following

    <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Holo.Theme">

  4. Edit you main.xml to include Holo theme widgets.

  5. Change your activity as follows

    public class ChkActionBarSherlock extends SherlockActivity {
        @Override
         public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        }
    
    }
    
azizbekian
  • 60,783
  • 13
  • 169
  • 249
Gaurav Agarwal
  • 18,754
  • 29
  • 105
  • 166
  • :i followed your steps for holo every where but it shows error on Dialogholo.java on this lines View customView = View.inflate(mContext, R.layout.alert_dialog_holo, null); mTitle = (TextView) customView.findViewById(R.id.alertTitle); R can not be resolved error,Holoalertdialogbuilder.java in this files error is on this line mTitle = (TextView) customTitle.findViewById(R.id.alertTitle); FontLoader.loadFont(mTitle, FontLoader.ROBOTO_REGULAR); mIcon = (ImageView) customTitle.findViewById(R.id.icon); setCustomTitle(customTitle); –  Jul 21 '12 at 14:12
  • You problem looks like `R can not be resolved`. Clean you project and trying googling for the error. Lots of data on this on Web. – Gaurav Agarwal Jul 21 '12 at 14:15
  • :I tried every thing nothing worked.When i import holoeverywhere lib to eclipse only,i get all this errors –  Jul 21 '12 at 14:23
  • :In this Follow these steps to add HoloEverywhere to your project ,can you explain step 4 and 5,i did n't under stand. –  Jul 21 '12 at 14:28
  • Make sure that you have "Compiler compliance level" set to 1.6. Project->Properties->Java Compiler->Compiler comliance level. – Johan B Sep 14 '12 at 09:18
  • I think the theme that changed name to: Holo.Theme.Sherlock.Light – Johan B Sep 14 '12 at 10:22
  • @JohanB You have to add a theme in Android Manifest, see which one works for you `android:theme="@style/Theme.HoloEverywhereDark.Sherlock"` – Gaurav Agarwal Sep 14 '12 at 12:44
  • 1
    Yes but from what I can see in the latest version there is no theme called Theme.HoloEverywhereDark.Sherlock, I use Holo.Theme.Sherlock.Light. – Johan B Sep 17 '12 at 11:38
  • 2
    The answer of **[coding crow](http://stackoverflow.com/users/932307/coding-crow)** is very useful BUT there is a missing step in the "" paragraph: The library **android-support-v4** in the "*libs*" folder of ActionSherlock projet should be removed and replaced by **android-support-v4-r13.jar** present in HoloEverywhere zip folder. – Souf Rochdi Jun 13 '13 at 13:19
  • i have tons of errors with the library after i've downloaded both the HoloEverywhere (v1.6.1) and the ActionBarSherlock library (v4.3.1) . only the actionBarSherlock has the android-support-v4.jar file. what is going on? – android developer Jun 19 '13 at 15:24
  • never mind. i've fixed it by choosing "add support library" to the actionBarSherlock library. now what i need is to learn how to use this library. hopefully it won't be hard. i hope my fix is correct though. – android developer Jun 19 '13 at 19:42
  • Hi.. This has worked for me in the past. But just realised that this does not work now for the latest version of holoeverywhere..https://github.com/Prototik/HoloEverywhere One needs to use egit for eclipse, which does not work for eclipse juno – ambit Jul 26 '13 at 14:40
  • @ambit You can still download the zip file from Prototik Holoeverywhere git repo. – Gaurav Agarwal Jul 26 '13 at 18:15
  • But doing it by these steps gives and error like http://stackoverflow.com/questions/14278884/holoeverywhere-error-build-path-contains-duplicate-entry-src – ambit Jul 27 '13 at 04:39
  • @ambit Ask a separate question,clearly mention your problem with links and images also you can look at IntelliJ Idea CE IDE for Android. – Gaurav Agarwal Jul 27 '13 at 10:46
  • Does this still work? On step 7 for adding HoloEverywhere, where ABS is added as a library to HoloEverywhere, I get about 1000 `error: Attribute "" has already been defined`. – Felix Oct 18 '13 at 20:14
  • @GauravAgarwal, thanks for the fast response! So I have the two library projects (ABS and HoloEverywhere) in my workspace. Neither knows about the other, ie, ABS is not being used by HoloEverywhere. I create a blank Android project. Adding either library project is fine, but as soon as I add both, I get those `error: Attribute "<...>" has already been defined` errors. Any ideas? – Felix Oct 18 '13 at 20:28
  • @nissemand HoloEverywhere uses ABS. ABS does not use HoloEverywhere. – Gaurav Agarwal Oct 18 '13 at 20:49
  • @GauravAgarwal, I figured it out! I was using the latest version of HoloEverywhere (following the instructions from [HoloEverywhere's github](https://github.com/Prototik/HoloEverywhere/wiki/Import-in-IDE#eclipse)), and apparently [the latest version is incompatible with ABS](https://github.com/Prototik/HoloEverywhere/issues/650). I used HoloEverywhere v1.6.8 instead, and everything works :) Thanks for the help Gaurav! – Felix Oct 18 '13 at 21:08
8

It seems that

android:theme="@style/Theme.HoloEverywhereDark.Sherlock"

cause an error.

change it:

android:theme="@style/Holo.Theme"

resons here:

Github

correct!

Sina
  • 607
  • 7
  • 22
daimajia
  • 967
  • 12
  • 15
4

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.

macsausi
  • 41
  • 1
1

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.

Mehdi Fanai
  • 4,021
  • 13
  • 50
  • 75