I am working on integrating twitter with my android application, I am using twitter4j library to do this.
I have added the twitter4j library files and put it in a folder libs and added compile dependency in build.gradle inside app folder
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'org.twitter4j:twitter4j-core:4.0.2'
}
but I am still not able to use this library
In the Gradle drawer to the right, could you hit the refresh button to see if that helps? Also, the dependencies block that you've pasted above doesn't contain a directive for twitter4j - did you happen to simply miss it out in the question, or is it really missing from the gradle.build file?
Try to add this at "repositories" on your buildscript.
repositories { mavenCentral() }
Related
i found lot of FFT library on github but i don't know how to add them to my project.
I try to import it without success.
Can you help?
Here what i found:
1) https://sites.google.com/site/piotrwendykier/software/jtransforms
2) https://github.com/wendykierp/JTransforms
If your project has a libs folder for external dependencies then you are good. Else create one under the main project. If you have the jar with all dependencies for the FFT algorithm, put it in the above mentioned libs folder. Next open build.gradle under app and add the following line under dependencies if it not already there..:
compile fileTree(dir: 'libs', include: ['*.jar'])
Sync the project as you usually do.
i need to include this library but i ve got several problems.
project library on github
i tried to follow the instructions on the github project but they did not work for me. I have to include the library in android studio.
i tried to:
1) copy the whole code in my project but i had a lot of conflicts about package, and, once solved, i began to have problems about lacks of functions not defined
2) i tried to use mvn install command, but it did not work, something like 100 errors displayed
3) i tried to open that project with intelliJ and then i tried to export jar file, but intelliJ told that it s an android project
does anyone have any idea about the procedure to include this library?
Thanks a lot in advance
you could give Jitpack a try. At least it worked for me..
See https://jitpack.io/
In essence: add following code to the build.gradle file of your project:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and add the following line to the dependencies section in the build.gradle file of your app:
`compile 'com.github.gturri:aXMLRPC:master-SNAPSHOT'`
here is what the dependency section looks like for me:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.github.gturri:aXMLRPC:master-SNAPSHOT'
compile 'com.android.support:support-v4:23.4.0'
}
I've created my game with Lib-GDX and I'm almost done! :D
the problem is that I forgot to include one of the Third Party feature in the initial GDX setup. Is there any way I can go back and include it, using the gds-setup.jar or any other way? Or must I go the super advanced way and create a new project and include the feature?
To be more precise I'm trying to include the libGDX cross platform Facebook support
You can just add your 3d party stuff to the build.gradle file for your case your need this :
compile "de.tomgrill.gdxfacebook:gdx-facebook-core:1.1.1"
to be added to the dependencies, there is no need of creating new project with gdx-setup.jar
check this topic in the officiel wiki for more info :
Dependency management with Gradle
I just created a new project with gdx-setup.jar and added the Third Party Ext. I wanted. Once that was complete i copied the code that called the TPE in the gradle files and added them to my original game's gradle so for Example:
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "de.tomgrill.gdxfacebook:gdx-facebook-android:1.1.1"//this is what I needed to add
compile fileTree(dir: 'libs', include: '*.jar')
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "de.tomgrill.gdxfacebook:gdx-facebook-core:1.1.1"//this was what I needed to add
compile fileTree(dir: 'libs', include: '*.jar')
}
}
this was all in the main project's gradle folder.
I'm doing the beginner android course on udacity and the code that they make you put in the MainActivity.java file is full of errors and keeps saying build failed in the console. Here is a link to a screenshot of android studio after failed build
http://postimg.org/image/6etcu6ldz/
I think support library is missing.
Go to your build.gradle (Module:app) and check if support library is in dependencies section.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.+'
}
In addition, you have to install it in SDK Manager.
I hope this answer will help you!
I am writing an android sdk and I now want to distribute it but I am having problems with its dependencies. I am using gradle and android studio.
My sdk has a dependency on volley and gson and I have them added as jars with in my sdk. When ever I try to create an aar or a jar to use within a separate client app I always get a crash when ever my sdk tries to reference volley as it wasnt included in either the aar or jar.
Any ideas on how I should be doing this? I have looked into creating fat jars with out much success.
I have also tried using remote dependencies like below but even after a gradle build in the client app both volley and gson are still not included.
This is currently what I have in my sdk build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.code.gson:gson:2.3'
}
then with in the client build gradle I have
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name:'mysdk-1.0.0', ext:'aar')
}
I am using ./gradlew clean build to build the aar and jar of my sdk
Can anyone tell me the correct way to include dependencies in my own lib?
If you wish to include the transitive dependencies of your library in your client app, you'll need to create a proper maven compatible package that contains a pom.xml. This pom will describe the dependencies of your lib, so that client can pull those deps transitively when they include your lib.
See this tutorial: http://blog.blundell-apps.com/locally-release-an-android-library-for-jcenter-or-maven-central-inclusion/
You don't have to upload the artifact anywhere during development, just use your local maven repo as a target, and have mavenLocal() as a repository for your client app.
This way, you'll be able to refer to your lib as a standard maven dependency using
compile 'com.mysdk:mysdk:1.0.0'
In your client, change your dependencies block like so:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name:'mysdk-1.0.0', ext:'aar') {
transitive = true
}
}
This should pull in your transitive dependencies as well.