Open build.gradle in Eclipse - java

I'm going to use the Facebook SDK in my application. I must open the build.gradle and add the following code:
repositories {
mavenCentral()
}
But where in Eclipse can I open this for my project? I have googled, but can't find any relevant information.

you need to add gradle plugin to eclipse and then configure your project to use gradle. For more reference check out the answer:
https://stackoverflow.com/a/14616328/3541465
OR
You can add Facebook sdks manually in eclipse. First import the Facebook sdk in eclipse then add it into your project.

Related

Adding a Maven Project to an Android Studio App as a Dependency

I am currently developing an Android App using Android Studio 1.2 .
I want to use an external Java Project as a Dependency in my Android App. This Java Project is a Maven Project.
How can I add this project right into my Android App as a dependency, so I can refer to Classes of the Java/Maven Project withtin my Android App?
The Android App is built using Grandle.
I found the answer.
You need to have Maven installed. Then you build the external project with maven. (you can use e.g. eclipse)
After that, the whole project can be found in your 'local maven repository'. The location is /{USER}/.m2/repository on a Windows machine.
Follow the structure to the project, you've just built.
Convert this path to a name space path:
/{USER}/.m2/repositoryorg/tuda/cdc/pp/classes/1.0
is converted to
org.tuda.cdc.pp:classes-plain:1.0
Pay attention to the double points at the end.
Now add the maevnLocal() thing to you project's grandle file:
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
And then add the following to your app's grandle file under dependencies:
compile 'org.tuda.cdc.pp:classes-plain:1.0'
Then you need to rebuild / sync the project with the changes of the grandle file. After that you are good to go.

Add android library project to Android project in Android Studio

I have Android project (main) that has a dependency on Android-library (library) project. I have that in Eclipse where I added library project, but now I want to use Android Studio where I cant find similar option. Is it possible to do it by Gradle where I build library project and main project take that from local repository or I need Maven to do so and if I can then how?
Import your Eclipse library-project (e.g. Facebook library-project), then in your project's settings.gradle refer to Facebook project's module local path in this way:
include ':facebook'
project(':facebook').projectDir = new File(settingsDir, '../facebook/app')

Upload eclipse project/library for use as a gradle dependency

I have a library that is being built in Eclipse, but I would like to upload it to jCenter to be used as a gradle dependency in an Android Studio project. I have tried building the gradle files in Eclipse, making a Bintray account, and trying to link it to jCenter but nothing seems to go through. It may be because I have not published it on Bintray, but I also do not see any option to publish it anyway.
You need to add Bintray plugin to your Gradle project. Please see the examples.

Add ZXing android project as library in android studio

I am making an app in android studio that uses a bar code scanner. I am using the Google ZXing lib. I downloaded the zip, opened the project and added the core.jar file as instructed but the tutorial was for eclipse and there is no option to add as library in android studio. so I am stuck on how to add it. any help would be greatly appreciated :)
Simple way with mvn repo:
dependencies {
compile 'com.google.zxing:core:3.0.0'
}
The more work version without mvn repo:
dependencies {
compile files('./libs/zxing/core.jar')
}
So whichever version you pick, look for the dependencies block in your build.gradle, then add in the appropriate compile line. Remember to add it into the build.gradle for your app module, not the root build.gradle.
Sample directory layout:
/approot
/approot/build.gradle
/approot/myfancyapp
/approot/myfancyapp/build.gradle <--- this one!
/approot/myfancyapp/libs/zxing/core.jar <--- put the jar here or any path, just an example.
If you add the compile files('libs/core.jar') to build.gradle, the only other thing you should need to do is click the Sync Project with Gradle Files button in the toolbar.

How to import project - intellij

I am experiencing difficulties to install some project based on a build.gradle file. I was told in a precedent post, that I should use Android Studio but it seems even more difficult (reported conflict for gradle 1.10 and Android Studio). So I am asking if it is possible to import the project directly in my ide, https://github.com/chrisbanes/ActionBar-PullToRefresh. If yes, should I put the library folder below in my libs folder ? Here's a screen of the file hierarchy
Since you are using Android Studio and Gradle, you could import it as suggested by the QuickStart page :
The easiest way to add ActionBar-PullToRefresh to your project is via
Gradle, you just need to add the following dependency to your
build.gradle:
dependencies {
mavenCentral()
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
}
I believe this is by far the easiest way to include that great library in your project.
If you are using Eclipse, you can still use the library, just download the project and create a create a new library project with the code from "library".
Check the guide http://www.jetbrains.com/idea/webhelp/cloning-a-repository-from-github.html
and other github integration http://www.jetbrains.com/idea/webhelp/using-github-integration.html

Categories