I can't access Crouton library in Eclipse - android

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:
Clone the Crouton library from GitHub.
Unzipped the file and copied out the library folder.
Open eclipse and import the library into the workspace (The name changes to 'main').
Right-click on 'main' and select Add Support Library in the android tools option.
Open project properties set build target to 4.4.2, and tick 'is library'.
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.

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.

Related

Where can I find android-v7 support library jar

I want to use the new ActionBarActivitiy class from the v7 support library but I cannot find the support JAR anywhere. I have a v7 folder in my extras directory but it contains 3 directories and not a jar
In Eclipse right click on on your Project -> Android Tools -> Add Support Library... and follow the instructions. As the result, required jar-file gets copied into your project's libs folder. Or you can add libraries manually how it is described in Android documentation.
Update 1: Android Tools team has made some changes to the way support library is integrated.
Android updates do this a bit different. There is still Android Tools -> Support Library option, but now it behaves a bit different. Once activated, Eclipse will silently create a new project called appcompat_v7 or similar. The name might change in the next versions of ADT. You must be able to find this project in your workspace. This project contains android-support-*.jar file. This is a new library project. In turn, your project receives a dependency on that library project.
You can stay with the updated configuration "as is" and start using compatibility API. Or alternatively, you can copy android-support-*.jar files into your project's lib folder and remove dependency on appcompat_v7 library project. Both options will work just fine.
Update 2: They change this behavior quite often. Try Project -> Android Tools -> Add Support Library... first. If it doesn't work, please check out official documentation for more recent information.
Update 3: It is really worth to migrate to Android Studio to avoid multiple issues with ATD nowadays.
ActionBarActivity is in an Android library project, not a JAR. There are instructions in the Android developer documentation for how to add an Android library project to your environment and attach it to your application project.
You have to update your Support Library through your SDK and then navigate to the folder where your SDK is located! Then go to : Extras->Google and you will find the Project and the jar included!

How can I use a project source code as a library for an another project?

I am a beginer in android.My client gave me a project source code(using native libraries) as a refference.Is there any possibilities to use these source code as library for my android project? If it is possible,how can I access methods of these library file? any one please help me..
Import the project into work space. Right click on the project in eclipse. Goto properties. Choose Android. Check if Is Library chexk box is ticked. If not tick the same. This is a library project now.
To refer the library project in your android project.
Right click on the project in eclipse. Goto properties. Choose Android. Click add. Browse the library project and add the same.
Clean and build.
For more information check the link
http://developer.android.com/tools/projects/projects-eclipse.html
Information regarding library project
http://developer.android.com/tools/projects/index.html
If the Android development tools build a project which uses a library project, it also builds the components of the library and adds them to the .apk file of the compiled application.
Therefore a library project can be considered to be a compile-time artifact. A Android library project can contain Java classes, Android components and resources. Only assets are not supported.
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
To use such a library, select the generated project, right-click on it and select properties. On the Android tab add the library project to it.
The library project must declare all its components, e.g. activities, service, etc. via the AndroidManifest.xml file. The application which uses the library must also declare all the used components via the AndroidManifest.xml file.
Other projects can now use this library project. This can also be set via the properties of the corresponding project.
Please check this
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
http://www.vogella.com/articles/AndroidLibraryProjects/article.html

Android app with eclipse project dependency

I have an Android app which uses a jar library generated from another Eclipse project.
But is it possible to directly reference this project instead of using an intermediate jar ?
When I do that, the build succeeds but I get VerifyErrors at runtime saying the classes of my external project can't be found...
Yes, you can directly reference this project by setting it as library. To do so:
Right click on your desired library project, choose properties and mark checkbox 'isLibrary'
Then just simply right click on you project, go to properties and add those library project
Yes, ADT supports libraries in form of shareable source code and resources, not just .jar. Please see Android Developer website, especially Managing Projects -> Library Projects article.

Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)

I'm trying to get ActionBarSherlock and the ViewPagerIndicator libraries set up for my projects, but I seem to be running into a few issues. I sent Jake Wharton (The developer) a few messages earlier about it, and got a few replies but couldn't get anywhere - and I think he got busy with a few other things.
What my issue is, For both VPI and ABS
Both libraries open up without any errors, and I'm using compiler version 1.6 for all as is required.
The funny thing is, if I load in the samples that are provided - they work fine and link to his library; but when I go to add the library to my project - the above happens.
Where to store the actual library project does not matter, as long as you use a relative link to reference it. Check out the Library Projects - Development considerations:
Library project storage location
There are no specific requirements on where you should store a library project, relative to a dependent application project, as long as the application project can reference the library project by a relative link. What is important is that the main project can reference the library project through a relative link.
You should always use the Eclipse ADT plugin to select and set up Library Project Reference, i.e. right-click project -> Properties -> Android -> Add, then in the opened Project Selection window, select the Library Project list here (of cause you should import them in the same Eclipse workspace as your Main Project). This will add a android.library.reference using relative path into project.properties as well as show relative path in the Android preference window:
android.library.reference.2=../../../../../Documents and Settings/yorkw/Desktop/JakeWharton-Android-ViewPagerIndicator-f09acb0/library
If you directly alter it using absolute path from project.properties as below:
android.library.reference.1=C:\\Documents and Settings\\yorkw\\Desktop\\JakeWharton-Android-ViewPagerIndicator-f09acb0\\library
Then after Eclipse refresh your project, you get the exact error described in your question, see my screenshot below:
Hope this helps.
While importing the libraries, make sure that you tick the "Copy projects int workspace" check box. The library projects need to be in the same workspace for them to work.
delete and import the project and lib again. build the lib project , add lib to project, still error shows.. rename the lib project. this worked for me ....

Could not find lvl License.apk

I am getting this error message when I try to run my app that has the lvl installed as a library.
I followed the steps outlined on the developer.android.com site for installing the lvl library:
I copied the "market_licensing" folder into my project folder,
I created a new library called "License" with "new", "android project using Motodev studio", "create project from existing source", "SDK Target" API-7.
I set the main project "project","properties", "android", "add library" to "License", and checked "IsLibrary".
Still, the lvl library doesn't seem to build with the main application, giving me this error.
I decided to give up on using the library concept to incorporate lvl after trying for 8 hours. The Eclipse/android environment is still too buggy to work with libraries.
The developer.android.com site provided an alternate (and much better) way to include the lvl code:
"As an alternative to adding the LVL as a library project, you can copy the library sources directly into your application. To do so, copy (or import) the LVL's library/src/com directory into your application's src/ directory."
I did this, and it works! Stay away from the use of libraries.
Eclipse IDE is buggy with this library paths.But I managed to get rid of it
First copy the LVL Library to the folder just at the same directory your project is located. This will make relative path simple e.g. '../library' instead of long path which make it buggy and Then try Import in eclipse
2.Add Library in the way described same in documentation
http://developer.android.com/google/play/licensing/setting-up.html
3.Remove Library Project from your Build Path. This library.apk not found error is just because you may have clicked on fix projected 'Add to Build Path' while removing error and adding library.

Categories

Resources