How to import library which has gradle dependencies - android

I have been trying to use tooltip in android app
referring https://github.com/nhaarman/supertooltips.
But I cant make the project run since it requires gradle dependency.
As soon as I import the project and try to run it it shows error.
How to compile it so that I can use it in my project

OK. Since you are using eclipse, you need to install Gradle plugin. There is an old nice tutorial here.
Here's the official spring guide and source code to Gradle plugin.
But particularly, if you are using eclipse Luna, you might want to review this question.

Related

How to use Android NDK and Fabric at the same time?

I have a Crashlytics-enabled app (which is now part of Twitter's Fabric) and I need to add some JNI functionality using the Android NDK.
I've switched to experimental gradle as Android Studio prompted me that way:
http://tools.android.com/tech-docs/new-build-system/gradle-experimental
When I've applied the necessary changes and tried to sync, I've got the error:
Crashlytics was applied to a project without an Android plugin. Please make sure the Crashlytics plugin is applied after the appropriate Android plugin for your project.
I've googled the error and found out that it's a problem between Fabric and experimental gradle, and Fabric team doesn't really seem to care about fixing it any time soon: https://twittercommunity.com/t/gradle-experiental-support/53441.
I've stumbled upon Issue with experimental gradle: The android plugin must be applied to the project but I have no idea what to do there, and I'm not sure if it's the right way to go?
How can I use Android NDK and Fabric in my project?
So gradle-experimental and Fabric don't mix.
Solution:
1) update to latest Android Studio 2.3.1
2) follow this tutorial to drop gradle experimental: https://developer.android.com/studio/projects/add-native-code.html
What I did was create a new temporary project with C++ support enabled and added a blank activity.
Then I opened my current project and the temporary project and copied the necessary changes into my own project.
After I was done (about 1 hour of work) I was able to build my C code into a library, load the library into my project, and make the JNI calls.

Migrating eclipse project from github to android studio

I am in the process of migrating my current project from eclipse to studio which is present on github.
My project makes use of google play services lib and an another library (calendar lib to be precise)
I tried many ways of migrating to studio following the tutorials on the net but I am not able to achieve it.
I am getting problem with my Google play service library. The error is cannot find resource #integer/google_play_services_version
At this point of time I confused don't know Wat to do. Can some please tell me proper way of migrating.
It will be of great help. Thanks in advance :)
You are seeing the error in Android Studio? This should not be the case, as Android studio handles libraries through gradle dependancies. You can check your build.gradle for the dependencies. If you are seeing this error, I assume it is in Eclipse, which the link #SurajPalwe13 provided should help fix.
Migrating from Eclipse to Android Studio should be as easy as Importing the Eclipse project into Android Studio.
In Android Studio, File > Import > Select Eclipse project directory. Then a import wizard should come up.
Alternatively, you can export your Eclipse Project to contain gradle files:
In the latest version of Eclipse, Right Click Project > Export > Android > Gradle. Then follow through the export wizard. You should then be able to import the build.gradle file in Android Studio.

How can I incorporate Gradle into my existing project on Eclipse?

I have this structure below and wish to incorporate Gradle to my existing project in Eclipse. Using the Facebook SDK in my project because the Login button on the home screen.
I have two questions: the first is how to integrate Gradle, the second is the standard folders and libraries are correct (There's something telling me that the Facebook SDK folder should not be there). Accept any kind of suggestion.
Thanks!
Note: I tried using Android Studio and IntelliJ to be my main IDE but was unable to add the Facebook SDK to my project (As both use the Gradle, and I tried to reproduce what I'm doing in Eclipse, I think it made it impossible addition)
First, add build.gradle for your project (and its dependencies).
Gradle for Eclipse page may help.
Second, try to search for Facebook SDK for Gradle. For gradle it should be one .aar file, that you would declare in main app build.gradle as one-liner like
compile 'com.android.support:appcompat-v7:19.0.+'

Migration from Eclipse to Android Studio

So,
as it seems that more and more people are using Android Studio i got curious and wanted to take a peek at it.
I have used Eclipse up until now and wanted to migrate a project to Android Studio. So i exported a gradle buildfile from within Eclipse, as android.developer.com suggested.
That worked fine, now i wanted to import that into Android Studio 0.3.2
When trying to import i got that Unable to import Eclipse project to Android Studio error. Now it is building.
But it got a new suprise, now before it is finished building, its asking specifically for an older Version of Gradle(1.6)... Ok, i can do that. Which leads me right back to the first error. So i tried this - Gradle version 1.6 is required. Current version is 1.8-20130730220035+0000
I can however create a New Project with Android Studio.
I've tried this for about an hour now and im getting sort of pissed, because it doesnt seem to know what it wants. Is it some sort of Bug or did i make some sort of mistake.
You're using a very old version of Android Studio. I'd recommend upgrading to 0.4.3. Versions later than 0.4.0 allow direct import of Eclipse projects instead of requiring you to do the cumbersome (and as you've seen problematic) export of projects from Eclipse; it's smarter about setting up the right plugin and Gradle versions. 0.4.3 has some important bugfixes over 0.4.0-0.4.2.
I've just migrated my projects. Here is two suggestions from my side.
Take the latest Android Studio.
Do not export / import projects from Eclipse. Most likely you are going to have errors in the project after this step. Starting from a clean project, which builds, will safe you a lot of time and avoid unnecessary frustration.
Create an empty Android Project in Android Studio. It must build without errors (⌘ F9). The start to enhance it using official Gradle Plugin user guide.
Create libraries folder and add all libraries in there one by one. Update build.gradle dependencies as mentioned in user guide. Make sure everything builds successfully.
After all libraries build you can copy-paste sources, resources and assets from Eclipse project to corresponding folders of Android Studio project. Make sure everything build as expected.
Now you can start with more advanced configuration like ProGuard configuration, release certificates etc.
I've done it in a couple of hours. Hope this helps you too.

Exporting an eclipse project as gradle

I have been trying to export my eclipse project as a gradle build file to use it with Android Studio but I can't seem to make it work correctly.
When I click "Finish" nothing happens. If I repeatedly click it, I can see a progress bar that shows for a millisecond and then vanishes.
My ADT is version 22.3 (which is the latest) and I have tried all of the solutions I found on google as well.
Similar questions can be found here:
Eclipse Gradle export of Android project does nothing
Cannot generate gradle.build files from Eclipse
As you can see, there is not really a solid solution for this problem, but people wrote they created it manually. I don't know how to do so though.
Is there any solution for this problem that I haven't heard of? If not, how can I create the file manually?
Apparently, the current edition of the export-to-Gradle support in Eclipse cannot handle a project that is attached to an Android library project. In that case, you would need to (temporarily) detach the Android library project, export the main project, then modify build.gradle to use the library project (manually or via Android Studio).
Generating build.gradle files FIRST FOR ALL of the projects in my dependencies ONE AFTER ANOTHER worked for me.
I generated build.gradle (with export wizrd for facebook, play and whatever other projects I imported and used in my project).
For not trivial Android project you should do it manually.
For the latest build.gradle template for classic Android project check gh.c/N/n-1/b/m/o.n.e.e.g/docs/android/build.gradle.
You can continue to develop in Eclipse with ADT and run Gradle build using Nodeclipse/Enide Gradle for Eclipse
(marketplace)
Some screenshots for Gradle for Eclipse:

Categories

Resources