Compile Twitter4j using gradle

I am trying to use a library twitter4j

. And I saw on their site that you can use Maven to integrate it.

So in my gradle.build file I did

buildscript {
repositories {
    mavenCentral()
jcenter()
}

      

and compile:

project(":core") {
apply plugin: "java"


dependencies {
    compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    compile 'org.twitter4j:twitter4j-core:4.0.3'
  }
}

      

It doesn't seem like a gimmick. I cannot use any of the classes from twitter4j

even after cleaning and updating everything. What worries me is that I downloaded twitter4j-4.0.3.zip

and extracted it, but I have never placed the folder or its contents anywhere? Feel like I'm missing something?

+3


source to share


1 answer


I ran into this kind of problem a few weeks ago when I try to use a library Twitter4j

via Gradle.

What I've done,

  • Downloaded the zip file Twitter4j

    from their site.
  • Open the extracted folder and there you will find the folder lib

    . Open it up.
  • You will find several files .lib

    for example twitter4j-core-4.0.3.jar

    . This file is core

    important and you need to add the remaining ones .jars

    when using this application. If you are not sure, copy everything .jars

    and paste it into the folder libs

    .

enter image description here



  1. Then click File → Project Structure → Select Application in the left column → select the Dependency tab.
  2. Click +

    in the upper right corner and select File Dependency

    then select banners in the libs folder.

enter image description here 6. Click "OK" and you're done.

Good luck :)

+2


source







All Articles