Android Twitter4j giving error NoClassDefFoundError: twitter4j.TwitterFactory

前端 未结 6 663
一个人的身影
一个人的身影 2021-01-01 04:26

I am making an app that communicates with Twitter to post a tweet. My problem is that when compile my code, I get the error message:

NoClassDefFoundError: tw         


        
相关标签:
6条回答
  • 2021-01-01 04:36

    Create a folder named libs inside the root directory of your project and put twitter4j jar inside.

    Then include new jar via Project Properties -> Java Build Path -> Libraries -> Add Jars.

    Remove any old reference to twitter4j jars.

    Clean and launch.

    0 讨论(0)
  • 2021-01-01 04:37

    try renaming the "lib" folder name to "libs". That solved a similar issue for me, check here: https://github.com/ddewaele/AndroidTwitterSample/issues/2

    0 讨论(0)
  • 2021-01-01 04:39

    I found that I Imported Twitter4J the incorrect way. So what I proceeded to do was remove it from my build path then copy twitter4j-core-4.0.2.jar to my libs folder then restart eclipse and add the jar in my libs to my build path. All was sorted thereafter.

    0 讨论(0)
  • 2021-01-01 04:48

    I've found the solution now. The problem was that I was using a very old version of Twitter4j, and in my libs folder, there were multiple jars with identical names. I have now fixed those problems and it is now working perfectly.

    0 讨论(0)
  • 2021-01-01 04:49

    I had the same problem with twitter4j, and I solved it. Simply after naming the folder to "libs", then I made the "libs" folder to be used as the source folder so as some methods within can be accessed. I wonder what is the actual chemistry behind it!! but that's it, it is now working for me. To make it a source folder, you simply right click it, go to the "build path" and then select "Use as source folder".

    0 讨论(0)
  • 2021-01-01 05:01

    I know it's too old but for those like me - the problem was solved by including log4j, slf4j and commons-logging jars in the project since twitter4j core uses them.

    0 讨论(0)
提交回复
热议问题