adding a project from GitHub - android

i am trying to add this project "https://github.com/47deg/android-swipelistview" into my project. I tried to add it to my workspace as a lib project but eclipse wont let me add the folder to my workspace.

You need to know, how to build Android Applications with the Gradle build tool. This needs some Prerequisites such as Apache Ant and Gradle.
Here is a good toutorial - http://www.vogella.com/tutorials/AndroidBuild/article.html
Before importing the library, complete an example using gradle. Then surely you'll know, how to do this one.

Related

Importing eclipse android project into android studio

I am trying to import an android project created in eclipse into android studio. This main project also refers to another library project in the same eclipse workspace. The folder structure is like this:
workspace\app1
workspace\lib1
When I import the main project into android studio, the library project is automatically imported as a sub-project (or shall we call it a module) within the main project. That's not what I want. The library project is shared by multiple apps I am maintaining. It should sit in parallel with other app projects in terms of folder structure. I wouldn't want it to go understand any particular app project.
Please help explain how I can make the library project stand its own and refer to the library project from other app projects in android project. I am fairly new to the gradle build system. So detailed instructions would be highly appreciated. Thanks a lot!
Since you are importing in android studio, I assume you are moving to gradle build system. In your case , I think, it would be best to have a separate AS project for library. Use that project to generate a jar file and then import that jar using gradle build script in each project you want to use it.
If you are sharing the same library across multiple, you can configure them as separate AS project and have "aar" file as output. (In your gradle you put>> apply plugin: 'android-library'). You then define them as dependency in your gradle file. (either through maven repo or putting it in your libs directory and defining it in your dependencies section). You can find more info at http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-projects
You can use version control tool such as git to synchronize the library project in every main project. But you need to use a version control tool to manage all your projects first.
Read here on "AS Modules"
review 57.1.2 on "common behavior"
Take a look at a project built on AS pattern of modules as libs used in eclipse (gradle.settings) pictured
all the includes are modules
maybe you can rethink the idea of how to get AS to work for you in reusing code....

Is it possible to integrate a gradle Library project to an android Project

First of all I'm new to Gradle and I've a limited knowledge in it.
I've an android project. What I need is to integrate a Gradle library project with my project.
So my question is, IS it possible to add Gradle library project with an android Project without converting the android project to Gradle Project???
Can any one Help me to find the solution? I'm using eclipse as the tool.
Thanks in advance!!!
Yes. you can do it
Try these methods
Method1: Manually reconfigure your gradle based library project folder structure like your regular eclipse projects
Method2: Import project then Properties > java build path > source tab....remove path to src....add path to java folder in the source code using add folder button... then build your project as usual

Eclipse -> Android Studio migration: how to include v4 support library (also including the ant build script)

I have a setup of android project on eclipse and I want to migrate to Android Studio. So, I have android-support-v4.jar that I use for my main project and my Facebook lib-project.
I guess I have to exclude lib-projects as a folder in my main module (lets call the main module Jack). Jack has dependancy on the facebook lib-project.
How should I define the android-support-v4.jar as a separate library and use it in both projects? Or should I just use directly the jar files and leave them in both Jack's libs folder and Facebook libs folder?
If the first option should be done, will ant clean release still work (with the build.xml android generated file)?
In Android Studio, builds are done with Gradle now. Gradle is different. With gradle, you tell your project which jar's you need, and it will connect to a server and download them if it doesn't already have them when you compile your apk.
A few things to note:
When you install Android Studio, it has it's own Android sdk directory. You have to download everything from the sdk downloader (from inside the Android Studio App) again. Don't bother trying to switch the sdk download path to your current one. You will only encounter bugs (Or at least I did).
So your question is worded very confusingly. It sounds like you have a main module, and then you have a library module, and the library module uses the support library.
You'll need to set it up so the main module has a dependency on your library module. From there, you'll need to go into your library module's gradle file and tell it that you want to include the android support library
dependencies {
compile 'com.android.support:appcompat-v7:19.0.0'
}
The support library is a little weird in gradle. Gradle normally would download the dependencies you need. However, android studio requires that you have the support library installed through their sdk downloader (top-right group of icons in android studio. The download icon).
After you get all your dependencies entered into your gradle file, you'll then need to go to Tools -> Android -> Sync gradle files with project. From there compile errors should go away, and you should be able to run the project.
Best of luck. By the way, Here is the documentation on Gradle on the android website. I find myself having to go to it A LOT, especially when I made the switch from Eclipse to Android Studio. This + Various tutorials I found as needed via google. http://tools.android.com/tech-docs/new-build-system/user-guide
EDIT: This link might also be helpful. Google has some steps for switching from eclipse to Android Studio: http://developer.android.com/sdk/installing/migrate.html That with some of the stuff above may prove helpful.
While I haven't tried this myself, I suggest you use the recommended migration steps provided by Google in this article.
Before you do that, though, make sure that you either:
Check that both support libraries on the main project and dependencies have the same version (Eclipse will complain about it during build time, and will likely cause problems during conversion to Gradle script.); OR,
Uncheck the "Android Private Libraries" entry on the Order and Export tab of the dependency project's build settings.
If the migration process described doesn't work smoothly for you, you can always call the Ant build script from within the Gradle script, as described here.
The Android Studio uses only Gradle, but you can export Android ant project from eclipse.
To do that go to File -> import project usually next, next, next... works.
If not go to project setting Shift + Ctrl + Alt + S and under modules -> PROJECT_NAME -> Dependencies you can add your support library.
To add a Facebook library you must add it as another module to your project.
If you still want to use Ant there is another option: Use Intellij IDEA which support Ant.

how to add external jar to eclipse projects while not disturbing version control

I need to add roottools to my android project and the way I was going to do it is to add the jar to my git repo and add the jar to my eclipse build configuration as mentioned here. The problem is, that the second step does not cause any change in the repo. The changes are only in the .classpath file which everyone suggests to add to gitignore. So the question is, how do I add the info that roottools.jar is included in the build path to my git repo?
Use a build tool, like Maven, that is not dependent on an IDE. Then check the build script (pom.xml in the case of Maven) into git.
Then you can still use Eclipse, as it has support for Maven.
Here is info about how to set up an Android project with Maven: http://code.google.com/p/maven-android-plugin/wiki/GettingStarted

How do I build my project with ANT when it depends on a non-library project with an Android library project dependency?

I'm trying to build my project using ANT. My project uses ActionbarSherlock, and Roboguice-Sherlock. ActionbarSherlock is an Android library project, but Roboguice-Sherlock is not. It's not even an Android project at all. See here:
https://github.com/rtyley/roboguice-sherlock
I can get ActionbarSherlock to build using ANT no problem, the problem lies with Roboguice-Sherlock. It's not an Android project, yet it has dependencies on Android and ActionbarSherlock, as well as Roboguice. When I try to build I get a ton of errors saying it can't find the Roboguice-Sherlock stuff.
If your project has the Roboguice .jar and the library project reference to ActionBarSherlock already configured you should be able to just drop it into your libs/ folder to have it automatically picked up.
I am working with Roberto to ensure that the .jar of his project gets uploaded to GitHub for non-Maven users to use.
For now, you can clone the project simply run mvn clean package to get a standalone .jar in the target/ folder which will enable you to do as I described above.
You need to add robiguice-sherlock as a .jar to your Android project. You can download it here (click Download (JAR)). Trying to build the source in Android will fail because it is not an Android project. Once it is in your directory, you need to open project properties and add the .jar to your build path.

Categories

Resources