I have this gradle file (this is the entire file):
apply plugin: 'java'
repositories {
jcenter()
}
dependencies {
compile 'com.stripe:stripe-android:5.0.0'
}
}
I'm running 'gradle build' and it's building, but in my java files I can't reference the new library. I'm adding this line to the source (java) file:
import com.stripe.android
I get this error: "The import com.stripe.android cannot be resolved"
Unfortunately, the problem is happened because the library is not supporting for Eclipse usage anymore.
From the documentation excerpt:
Eclipse
Note - as Google has stopped supporting Eclipse for Android
Development, we will no longer be actively testing the project's
compatibility within Eclipse. You may still clone and include the
library as you would any other Android library project.
So, you need to clone and include the library manually or migrate your code to Android Studio.
Related
I have to create an application that makes extensive use of charts.
Reading the web I chose achartengine that seems to have everything I need.
I downloaded the jar file, I plugged in the libs folder, I selected "add to library" and I lunch the gradlew clean.
Result in the sources where I do the import of org.achartengine.xxxx I always returned the error that fails to resolve symbols .
Do you have suggestions?
Thank you
Andrea
I am able to use this library in my Android Studio project, this topic explains how to add AChartEngine repo to your project.
What I did:
Added following to project-wide build.gradle (one from the project root):
allprojects {
repositories {
...
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
}
For every module that uses the library, add this to its build.gradle (you may put this to the top-level build.gradle if it should be included in all modules):
dependencies {
...
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
Now I can use the library in the project, I see the classes in code assist popups and build runs as succeeds.
It seems like the new version (1.2.0) is not available for download anymore in the http://www.achartengine.org/ site. and that's why the gradle/maven method doesn't work (or the snapshot file was removed).
I succeeded using and adding it to my project by downloading the jar file from here:
https://github.com/ddanny/achartengine/files/460139/achartengine-1.2.0.zip
I have a legacy eclipse Android project. The classic old way without gradle.
Suppose I found a library I want to integrate with, for example 'commons-codec', than quoting from gradle manual https://docs.gradle.org/current/userguide/organizing_build_logic.html#sec:external_dependencies, I need to paste the below in my gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'commons-codec', name: 'commons-codec', version: '1.2'
}
}
Now my eclipse project does not use gradle.
The Question: Is there a way to get the binary lib & integrate with it in eclipse (something similar to download the library's jar and add it)? I know this question is bizarre since I need the jar to be in the repository, but I want to be sure I'm not overlooking anything.
Many Thanks!
If you're just using a jar, you can include it in the libs folder of the Eclipse project. But that's code only. If there's resources in the library, you'd need to build an Android Library project out of it and include that in your project. Which I'm not sure how you'd do without code.
If you are having .jar file the simply right click on your project then
Properties-->Java Build Path-->Libraries-->Add Jar/ Add External Jar--> Apply
And if you are having library in your workspace then
Properties-->Android-->Add-->locate your library-->Apply
I'm using Eclipse for developing an Android application. I need to use a library that can be imported using gradle (from Maven repository), since the jar is not provided. How can I do this?
Have you try this link?
Create a new folder called basic-eclipse.
Inside the folder, create folders src/main/java.
Create the Gradle build file in the basic-eclipse folder with the following contents:
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
targetCompatibility = 1.6
dependencies {
compile 'commons-lang:commons-lang:20030203.000129'
testCompile 'junit:junit:4.+'
}
From the command line, run gradle eclipse
Now, go into Eclipse and choose File -> Import -> Existing Projects into Workspace and choose the basic-eclipse folder that you created.
import-eclipse-project Notice that src/main/java is automatically configured to be the source directory. Also, the Commons-Lang and Junit jars have been downloaded and added to our build path automatically (in addition to Hamcrest, a jar that Junit depends on).
Unfortunately, the Android Development Toolkit (ADT) does not yet support AAR dependencies.
Please see here for more information:
https://code.google.com/p/android/issues/detail?id=59183
There is an open ticket for the Android for Maven Eclipse project to bring AAR support to Eclipse:
https://github.com/rgladwell/m2e-android/issues/177
Also, the Andmore project is looking to bring AAR support to Eclipse:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=459569
According to your questions,you want to import '.jar' and '.aar',I think you should chose AS.
I'm trying to implement a Facebook Like Button in an app and I just found a good library: Facebook Like Button by shamanland.
Now the problem is that I'm using Eclipse and I can't figure out how to import this project correctly in order to use it in the app.
Can anyone help?
Thanks!
That project uses the gradle build system, but eclipse uses the ant system.
Google is leaving ant and migrating to the new gradle system which is used with their new Android Studio IDE. Most of the new libraries also are migrating to gradle due to easy dependency management.
This is a good time to migrate your project to Android Studio.
Download it and when you import your project, it will automatically convert it to gradle.
Then you can easily add gradle libraries to your project's build.gradle, and it will take care of downloading and maintaining them.
For this particular library, you have to add the following to your build.gradle:
repositories {
mavenCentral()
}
dependencies {
compile 'com.shamanland:facebook-like-button:0.1.6'
}
You can also download the Gradle plugin for Eclipse, but it may not be fully compatible with ADT. It's better to use the Android Studio and avoid the headache.
More Info Here
You may download compiled aar file from the Maven Cental.
Just import this aar into your Eclipse project as standalone library.
I have to create an application that makes extensive use of charts.
Reading the web I chose achartengine that seems to have everything I need.
I downloaded the jar file, I plugged in the libs folder, I selected "add to library" and I lunch the gradlew clean.
Result in the sources where I do the import of org.achartengine.xxxx I always returned the error that fails to resolve symbols .
Do you have suggestions?
Thank you
Andrea
I am able to use this library in my Android Studio project, this topic explains how to add AChartEngine repo to your project.
What I did:
Added following to project-wide build.gradle (one from the project root):
allprojects {
repositories {
...
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
}
For every module that uses the library, add this to its build.gradle (you may put this to the top-level build.gradle if it should be included in all modules):
dependencies {
...
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
Now I can use the library in the project, I see the classes in code assist popups and build runs as succeeds.
It seems like the new version (1.2.0) is not available for download anymore in the http://www.achartengine.org/ site. and that's why the gradle/maven method doesn't work (or the snapshot file was removed).
I succeeded using and adding it to my project by downloading the jar file from here:
https://github.com/ddanny/achartengine/files/460139/achartengine-1.2.0.zip