Android SlidingMenu library installation - android

I am trying to follow this tutorial.
The aim is to integrate the SlidingMenu android library. As per the instructions in the tutorial:
For non-maven project : Copy
library/target/slidingmenu-1.3-SNAPSHOT.jar into the libs directory of
your project.
I don't know how to use Maven and I don't want to introduce another layer of complexity.
So, where can I locate the library/target/slidingmenu-1.3-SNAPSHOT.jar file?
Update
With the exception of the Maven section, I followed the tutorial completely but got the following single error:
slidingmenu cannot be resolved or is not a field
The error is caused by this line of code:
slidingMenu.setMenu(R.layout.slidingmenu);
I'm a beginner but I know that's an issue of a missing resource. What I don't know is if it's related to the Maven issue. How can I fix it?

So without implementing maven, all you need to do is download that library from your link on github (here). It is only 4.4 MB.
On that github page, there should be a button that says "Download ZIP".
Once you save the zip file, open the zip file, and navigate the contents... inside the library folder, you can find the source files of the SlidingMenu solution.
The QUICKEST way to get this into your project is to copy the contents of the libs, res, and src folders into the respective folders in your project.
The SlidingMenu project on github cannot merely be a .jar file, since it contains visual assets as well (ie. items in the /res folder are needed).
Another approach is to create a separate project on your computer named SlidingMenu (create it as a "library" project) and then include this project into your own project as a dependency. The manner in which to do this varies by IDE (Eclipse, IntelliJ, AndroidStudio, etc). Hopefully you're using one of those IDEs.

Related

Android Studio import library from github where no jar file is provided

I want to use the API from Maps.Me. I've
downloaded the repository from github
extracted the files
copied the lib folder
created a libs folder as ...AndroidStudioProjects[MyApp]\app\libs
pasted the lib folder into the libs folder
The instructions on github say I should then "add the library project to [my] project". My problem is that all the advice I can find here and elsewhere online assumes that I will have a jar file which I will now see in Android Studio. I don't have a jar file and I can't see a libs folder anywhere in the Project tab on Android Studio.
(The libs folder that I have created contains the folders and files that I would expect to see in an Android Studio project folder, namely res and src folders and AndroidManifest.xml, build.gradle, build.xml and project.properties files)
What do I do next?
One thought is that I should import the downloaded library as a new project into Android Studio and then create a jar file from it. Would this work? Perhaps there is an easier way?
In case it helps anyone coming to this thread in future, I'll describe how I have worked around this issue.
As can be seen from the comments, I failed to import the library into my app in Android Studio, despite all the helpful guidance from CommonsWare. If I were more familiar with Android Studio, and Gradle specifically, I hope that I would have been able to succeed. However, I have followed a route which, for me with my limited experience of Android Studio, is more straightforward.
For each class in the downloaded repository I added a new Java class to my app with the same name.
I did not include one of the classes which included a dialog and relied on a layout and other resources, since I knew that I would not need this class
I copied all the code, except in each case for the package name, from each class in the depository and pasted it into the new classes.
I removed from the code that I did copy the one reference to the missing class
the result was code that worked exactly (so far as I know) as if I had imported the library.
Obviously, the result is inelegant, but for an app that is solely for my personal use it is good enough. It works.

Using android library project, with multiple src / res folders?

Sorry for what is probably a rather basic question, but I can't find the answer...
I downloaded a project from github, and I'm having trouble setting it up. I have virtually nill experience using code repositories. The project is is flagged as an android library project, and has two sets of source folders and resource folders buried in sub directories. Each src folder is dependent on its own resource folder.
You can see the project layout in the pic below.
Android gives me error that there are no "src" or "res" folders in the main directory. I tried using "build path > use as source folder" options to make android recognize them, but this leads to errors about not being able to find the resource folders.
How am I suppose to set this up?
I have used that library before. the problem you are facing is due to wrongly importing the whole repository as 1 project.
it is actually 2 separate projects:
two-way-gridview. this is the library project. you should import this subfolder on its' own.
sample. this is a sample project with examples how to use two-way-grid correctly.
you need to import both separately for it to work.

How to include external libs in Android source controlled project?

How should external libraries be included into Android projects?
I see this documentation from Google:
http://developer.android.com/tools/support-library/setup.html#libs-with-res
...which says they should be kept outside the source tree for the project, and referenced as dependencies.
The guide for Facebook libraries says the same thing:
https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/
What about when the project is going into source control, and will be worked on by multiple developers? Is it possible to be sure other developers will have the correct versions of libraries if they're not included in source control?
It seems as though it might be better to check in the whole tree of these external libraries under say an "external" folder in the project and then reference them as libraries from there? The above links don't say this is wrong, but is there any reason not to do that?
I could not find anything against this approach, but maybe my search skills are off.
Thanks!
You have basically tree options (referring to git):
Putting the source or binaries into your git repository.
You can create/clone extra repositories and link these as submodule into your main repository.
Use gradle/android-studio to maintain remote binary dependencies.
In my opinion, option 3. is the best. It speeds up build time and reduces the date saved in your internal repository. Referencing most open source projects, googles libraries and even the Facebook API is just a one liner in your build.gradle file.
For internal libraries or anything not uploaded to some maven repository, you can create a local maven repository and link that.
And in the end, you have the option 2. to create a library submodule within git and gradle to handle it efficiently.
If you want to stick to eclipse + ant, try 2. first.
At least ant will work out of the box for building all things.
Setting up eclipse is a bit more difficult but can be done.
Option 1. is easy to implement, but It might get messy at some point.
Copy jar file in android project libs forlder and right click on jar file and click on bulid path-> add to build path.
If you want to add jar file then copy your jar file and put in to libs folder, and if you want to add external library then import your library project go to project properties and select android tab and add external library with add button.

Creating jar Library of Android project?

I have a project that uses some resources.I want to create a library from it and publish it.I create a jar file with export option of eclipse,but it did not work.Then I search the we b and it seems that way works if and only if project does not use resources.But I saw this post.Here CommonsWare saya there is a way to create a jar file from a project that uses resources.But that answer has two link that do not open any page on the web and I could not test CommonsWare's answer.So my question is:
Is there any way to create jar library file from project that uses resources?
Note:
I read docs that say:
If you have source code and resources that are common to multiple
Android projects, you can move them to a library project so that it is
easier to maintain across applications and versions.
But as I said before,I want to publish my jar and docs say we can not create jar file from library project.And so I can not publish it.
Here CommonsWare saya there is a way to create a jar file from a project that uses resources.
Not in that answer. You can tell that by actually reading the answer.
But that answer has two link that do not open any page on the web
Sorry, Google reorganized their site and broke the original links. The answer has been updated with current links.
Is there any way to create jar library file from project that uses resources?
No.
You can create an Android library project that includes a JAR instead of Java source code. AFAIK, this recipe still works:
Create an Android library project, with your source code, resources, and such, and get it working
Compile the Java source (e.g., via Ant) and turn it into a JAR file
Create a copy of your original Android library project to serve as a distribution Android library project
Place the compiled JAR from step #2 and put it in libs/ of the distribution library project from step #3.
Delete everything in src/ of the distribution library project (but leave the now-empty src/ directory there)
Distribute the distribution library project (e.g., ZIP it up)
And the new Gradle-based build system supports the AAR package for distributing libraries and such, though I have not played with this yet.

How do I add the JJIL libraries to my Android Eclipse project?

I'm trying to use the JJIL libraries with my Android project:
http://code.google.com/p/jjil/
I followed all the instructions on importing libraries into eclipse on the android guides, and have had no successes. It just fails to import.
Can some one point me in the right direction with this?
Cheers,
Nick D
I recommend you download the source and add it to your project. A lot of compiled .jars won't work in Android because they contain stuff that needs to be converted to the Dalvik format. Just download the source from their google code repository and copy it into the /src folder of your project (with the whole com/whatever/whatever/ directory structure, too). The next time you start Eclipse, the source for those libraries should be in your project and building.

Categories

Resources