- Home /
Android twitter shows error.
Hi, I'm trying to integrate twitter sdk through android plugin but it shows error on start of the app " java.lang.NoClassDefFoundError: twitter4j.conf.ConfigurationBuilder"
It looks like you might have not included the native plugin/library.
Without more information, you are not very likely to get anything more useful than that. :( Which twitter plugin you are using? twitter4j is a native library, included with many Asset Store plugins, not knowing which one you're having trouble with limits how much help people can give you
@Tarlius i'm using "twitter4j-core-4.0.1.jar" and i've included it in my android project which is later used as a Plugin.
Following is the code snippet used for twitter login
if (!isTwitterLoggedInAlready())
{
Log.i(TAG,"Java --- aaaaaaaaaaaaaaaaaaaa");
//ConfigurationBuilder bd = new ConfigurationBuilder();
ConfigurationBuilder bd = new ConfigurationBuilder();
Log.i(TAG, "----------- : "+bd);
bd.setOAuthConsumer$$anonymous$$ey(TWITTER_CONSU$$anonymous$$ER_$$anonymous$$EY);
Log.i(TAG,"Java --- bbbbbbbbbbbbbbbbbbbb");
bd.setOAuthConsumerSecret(TWITTER_CONSU$$anonymous$$ER_SECRET);
Log.i(TAG,"Java --- ccccccccccccccccc");
Configuration configuration = bd.build();
Log.i(TAG,"Java --- ddddddddddddddddd");
TwitterFactory factory = new TwitterFactory(configuration);
twitter = factory.getInstance();
Log.i(TAG,"Java --- eeeeeeeeeeeeeeeee");
try {
requestToken = twitter
.getOAuthRequestToken(TWITTER_CALLBAC$$anonymous$$_URL);
Log.i(TAG,"Java --- fffffffff : "+requestToken);
UnityPlayer.currentActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse(requestToken.getAuthenticationURL())));
Log.i(TAG,"Java --- gggggggggggggg : ");
} catch (TwitterException e) {
e.printStackTrace();
}
}
Got the Log of "Java --- aaaaaaaaaaaaaaaaaaaa" after that my app get crashed
Oh you're calling it all directly from C#? Fair enough...
It looks the the class name is correct, so perhaps theres a problem with how you added it to the project. How did you add it?
Also how are you calling it?
I've no issue with unity to java calling. Don't know why it gives error on app start though i got all promts in java regarding twitter. I've added it in Plugins ->Android folder
unity native calling for Twitter Login
public static void TwitterLogin()
{
#if UNITY_ANDROID
AndroidJavaObject playerActivityContext = null;
if (Application.platform == RuntimePlatform.Android)
{
using (var actClass = new AndroidJavaClass(UNITY_CLASS_NA$$anonymous$$E)) {
playerActivityContext = actClass.GetStatic<AndroidJavaObject>(UNITY_ACTIVITY);
}
using (var pluginClass = new AndroidJavaClass(JAVA_CLASS_NA$$anonymous$$E))
{
if (pluginClass != null)
{
pluginClass.CallStatic("LoginTwitter");
}
}
}
#endif
}
Ahh so you made a plugin .jar which makes calls in Java to twitter4j. Did you add both the twitter4j .jar and your own .jar to the Assets/Plugins/Android folder?
Or did you export an eclipse project in which you added the calling code or something?
Your answer
Follow this Question
Related Questions
Twitter Unity Free Plugin 1 Answer
Post Data on Twitter 1 Answer
Social Networking Aggregation Services 0 Answers
android - native twitter connect 0 Answers
How can I access frame data using C# from the NatNetML.dll 0 Answers