5

I followed all the steps for using the crouton library with Eclipse, but I still have not been able to use it.

Here are the steps I followed:

  1. Clone the Crouton library from GitHub.
  2. Unzipped the file and copied out the library folder.
  3. Open eclipse and import the library into the workspace (The name changes to 'main').
  4. Right-click on 'main' and select Add Support Library in the android tools option.
  5. Open project properties set build target to 4.4.2, and tick 'is library'.
  6. In the project which I want to use crouton, I add it as a library from the property option.

After all these steps when I try to create a crouton. For example:

Crouton.showText(
  this, 
  getString(R.string.crouton_message2), 
  Style.CONFIRM); 

Eclipse says Crouton cannot be resolved to a variable. When I to try import it, I can't find it.

These are the same steps followed in all my research, here's what I found, a post from Grokking android and a YouTube video

This is not the first time I am using a library. I have been using the android appcompat library for a while now with out any problems. And the steps i used in setting it up are pretty much the same with is, except that in the appcompat library after all the above steps, I had to copy the jar file and put it in the lib. folder of the project that needs it. I'm I missing anything?

Thank you for your help.

nbanic
  • 1,270
  • 1
  • 8
  • 11
bibi_bryan
  • 371
  • 3
  • 17
  • Which version of Crouton are you using? Are you trying to develop for Crouton or use it within your project? Also, what build system are you utilizing? – Ben Weiss Jan 16 '14 at 09:57
  • Can you check that the Crouton jar is present in the related bin directory ? – lithos35 Jan 16 '14 at 10:06
  • @keyboardsurfer i am trying to use it in my project. And my build system is 1.6. – bibi_bryan Jan 16 '14 at 10:15
  • @lithos35 when i import crouton lib. to my workspace, the name changes to main. So in my bin folder what i have is main.jar – bibi_bryan Jan 16 '14 at 10:17
  • With build system I meant: ant, maven, gradle or anything like this. Which version of Crouton are you trying to use? – Ben Weiss Jan 16 '14 at 10:18
  • @keyboardsurfer i am not sure i understand. What i am using is my default Eclipse. The crouton i'm using is version 1.8.2 – bibi_bryan Jan 16 '14 at 10:24

1 Answers1

11

Crouton is being built using gradle. This means that the source directories are different to the default Eclipse source paths.

I discourage building without a proper build system. Nonetheless, using version 1.8.2 of Crouton within Eclipse is possible.

To do so, simply download the jar from maven central and put it in your libs folder.

Since the current version of Crouton does not rely on resources, adding it as a library is not necessary.

Ben Weiss
  • 17,182
  • 6
  • 67
  • 87
  • Please can u point me to where i can learn more about build systems? – bibi_bryan Jan 16 '14 at 10:45
  • 1
    When working with Android I reccomend http://gradle.org and http://tools.android.com/tech-docs/new-build-system – Ben Weiss Jan 16 '14 at 10:51
  • Please i have encountered a new problem,[here](http://stackoverflow.com/questions/21181270/java-lang-noclassdeffounderror-when-crouton-library-in-eclipse) – bibi_bryan Jan 17 '14 at 08:39
  • I too had the same issue, I was reading through many blogs and was breaking my head until I found this :) This made my day..A simple solution..Thank You – Bala Vishnu May 10 '14 at 11:55