How to import project - intellij - java

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

Related

No "Add to library" button when on a file

I am trying to add this fil(math parser) to my library, but there seems to be no "add to library" when i right click it. Any help?
Here's the website that I downloaded the files from idk if it will help but it's here: https://mathparser.org/mxparser-api/
I use JDK 8.
The easiest way to manage dependencies for a library is to use a build tool like Maven or Gradle. These tools help you to download and utilize dependencies in your own software and give attribution to the original authors as well as include the necessary license files. You tagged this with Android Studio so I assume this is going to be a library for Android applications. Most Android applications use Gradle as a build tool. Your application probably has a build.gradle where you can more easily manage your dependencies.
Instead of jar download I suggest just to add proper dependency to the gradle file
Maven – Gradle
implementation 'org.mariuszgromada.math:MathParser.org-mXparser:5.0.6'
Maven – Gradle (Kotlin)
implementation("org.mariuszgromada.math:MathParser.org-mXparser:5.0.6")

How to load a gradle project and then use that as a dependency in one of the existing projects in IntelliJ

I have a gradle zip file that I want to use as a dependency in my project in intelliJ.
So I opened that project using Open and then pointing to build.gradle file. Tried to run it and got Could not find or load main class.
How to solve this and then also how to add this project to some other project as a dependency in IntelliJ.
I am fairly new to IntelliJ and Java project settings, will appreciate any help. Thanks in advance!
To add it as a dependency you can use this this
The developers of that project have chosen to promote JitPack as the way to consume their JARs. You can tell because their Github project page has a little "JitPack" badge at the top of the readme. If you click on that badge, it takes you to this page showing how to add the dependency to your Gradle or Maven project.
If you're not yet using Maven or Gradle, this is a great opportunity to learn :-)
Gradle Java tutorial
Maven tutorial
When you open your Maven or Gradle project in IntelliJ, it will automatically resolve the dependencies for you.

How to add Maven and ProGuard to android application

I am trying to incorporate the Google Direction Library created by https://github.com/akexorcist/Android-GoogleDirectionLibrary
In the README it shows the following downloads. I know how to add gradle dependencies, but what does adding proguard and maven do and how do I add it?
Maven
Proguard
You can add the dependency either via Maven OR Gradle. So if you're using Gradle, that's 100% fine and just do that.
As for Proguard, there should be a file called "proguard-rules.pro" or something like that in your project. Simply copy the text from the Github page and paste it into that file in your project.
That's it.

How do I add a Github library to my Android Project as a JAR in Eclipse?

I'm trying to add https://github.com/astuetz/PagerSlidingTabStrip to my project. Looking at it, I notice that it has files in res and depends on its own R.java file. When I make it a JAR I continue to get errors because the dependencies aren't all there. I'm not sure how to get this to work.
I keep getting errors like
import android.support cannot be resolved and everything else too. I tried referencing different answers on StackOverflow but none of them yielded a working solution.
The resources won't be packaged into the JAR file. Google is working on a new packaging scheme called AAR which is supported by Android Studio.
In order to use this third-party library in your own project, you should clone it to a local repo. Then you can import it directly into your Eclipse workspace and then add the Eclipse project to the classpath of your app's project.
Download the whole source code from https://github.com/astuetz/PagerSlidingTabStrip by git tool.
On your Eclipse IDE, import the library as exsisting source code at Android option.
Add the library your add before into your project.

Using subproject Artifacts in Android Build with gradle

im still quite new to gradle. I decided to transfer some code i oft use into an subproject. This subproject is a pure java project, so im using only the apply plugin: 'java' there.
I can build this project and in the build folder is see a jar which contains the compiled classes after the gradle assemble command was invoked.
What really bugs me at the moment is, how can i use the classes in my Android project using Android Studio ?
I tried to use the compile project command:
compile project(':PureJavaSubProject')
And it compiles the Project as expected. But Android Studio is not able to see the artifacts created by the Project ?
I read a bit in the Gradle Docs about Artifacts management but the Doc is not clear for me.
Anyone can point me how i need to declare or setup the gradle build to make it work ?
Are you including the subproject from your root project in your settings.gradle?
include 'PureJavaSubProject'
I can't verify from Android Studio I'm afraid. There is also more doc on multi project builds here:
http://www.gradle.org/docs/current/userguide/multi_project_builds.html
I had this same issue, and it turned out I had the directory structure for the Java subproject slightly wrong (I had copied it from another existing Eclipse project).
I had:
java-subproject/src/com/example/MyJavaClass.java
...when it should have been:
java-subproject/src/main/java/com/example/MyJavaClass.java
When I changed it to the correct structure, the main Android project then picked up the classes in the Java sub-project fine.
A fully working example of an Android Studio project with a pure Java sub-project can be see here on Github:
https://github.com/barbeau/JavaSubprojectDemo

Categories