Social Plugin (Twitter) not working on Android

Hey there !

I’ve implemented the possibility to tweet from my app, by using

local options = { message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce molestie vitae nunc id dictum. #Lolz", listener = tweetCallback, image = { baseDir = system.ResourceDirectory, filename = "images/twitter.png", url= "#" } } native.showPopup("twitter", options)

It works fine on iOS, but on Android, I’ve got this on the console :

V/Corona ( 6920): \> Class.forName: CoronaProvider.\_native.popup.twitter.LuaLoader V/Corona ( 6920): WARNING: Could not load 'LuaLoader' W/System.err( 6920): java.lang.ClassNotFoundException: CoronaProvider.\_native.popup.twitter.LuaLoader W/System.err( 6920): at java.lang.Class.classForName(Native Method) W/System.err( 6920): at java.lang.Class.forName(Class.java:308) W/System.err( 6920): at java.lang.Class.forName(Class.java:272) W/System.err( 6920): at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:310) W/System.err( 6920): at com.ansca.corona.JavaToNativeShim.nativeTouchEvent(Native Method) W/System.err( 6920): at com.ansca.corona.JavaToNativeShim.touchEvent(JavaToNativeShim.java:404) W/System.err( 6920): at com.ansca.corona.input.RaiseTouchEventTask.executeUsing(RaiseTouchEventTask.java:39) W/System.err( 6920): at com.ansca.corona.CoronaRuntimeTaskDispatcher$TaskEvent.Send(CoronaRuntimeTaskDispatcher.java:148) W/System.err( 6920): at com.ansca.corona.events.EventManager.sendEvents(EventManager.java:87) W/System.err( 6920): at com.ansca.corona.Controller.updateRuntimeState(Controller.java:281) W/System.err( 6920): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:417) W/System.err( 6920): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622) W/System.err( 6920): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) W/System.err( 6920): Caused by: java.lang.ClassNotFoundException: Didn't find class "CoronaProvider.\_native.popup.twitter.LuaLoader" on path: DexPathList[[zip file "/data/app/XXXXXXXXXXXXXXXX/base.apk"],nativeLibraryDirectories=[/data/app/XXXXXXXXXXXXXXXXXXX/lib/arm, /vendor/lib, /system/lib]] W/System.err( 6920): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) W/System.err( 6920): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) W/System.err( 6920): at java.lang.ClassLoader.loadClass(ClassLoader.java:469) W/System.err( 6920): ... 13 more W/System.err( 6920): Suppressed: java.lang.ClassNotFoundException: CoronaProvider.\_native.popup.twitter.LuaLoader W/System.err( 6920): at java.lang.Class.classForName(Native Method) W/System.err( 6920): at java.lang.BootClassLoader.findClass(ClassLoader.java:781) W/System.err( 6920): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) W/System.err( 6920): at java.lang.ClassLoader.loadClass(ClassLoader.java:504) W/System.err( 6920): ... 14 more W/System.err( 6920): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available I/SoundDecoder\_SetError( 6920): Cannot operate on sample because already at EOF

I think it comes from my build.settings file but I must admit, I’m pretty confused by it :

settings = { plugins = { ["CoronaProvider.analytics.flurry"] = { publisherId = "com.coronalabs" }, ["facebook"] = { publisherId = "com.coronalabs" }, ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone = true }, } }, iphone = { plist = { UIApplicationExitsOnSuspend = false, FacebookAppID = "XXXXXXXXXXXXXXXXXXXXX", CFBundleURLTypes = { { CFBundleURLSchemes = {"XXXXXXXXXXXXXXXX",} } }, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-72@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", } }, }, android = { versoinCode = "1", versionName = "1.0", usesPermissions = { "android.permission.INTERNET", "android.permission.VIBRATE" }, }, orientation = { default = "landscapeRight", supported = { "landscapeLeft", "landscapeRight" }, }, }

Do you have any ideas ?

My build.settings file has this entry for the social plugin:

 ["CoronaProvider.native.popup.social"] = { --required publisherId = "com.coronalabs", },

You have the extra line defining the platform. Maybe that’s the problem? Try taking that out and testing to see if it makes a difference.

<evanspro>: The problem you’ve encountered is that native.showPopup’s Twitter-specific functionality is available only on iOS (Corona’s docs could be clearer on this point).

On Android, you can pull up the standard system share panel that gives you access to Twitter and almost all the other apps that are registered with the OS. Unfortunately a big exception is Facebook sharing, which is broken but Corona is working on it: http://forums.coronalabs.com/topic/52755-can-corona-enable-limited-facebook-sharing-on-android-via-nativeshowpopup/

Do some searches in the docs and you’ll see how to use the Android share functionality.

And here’s an Android tutorial that Rob wrote: https://coronalabs.com/blog/2013/10/11/revisiting-the-social-plugin-now-on-android/

Alx@Panc : You’re right ! But I actually that line after trying once… just wanted to be sure !

corona273 : Oh… For sure, Corona’s doc should be definitely clearer on this point. So if I understand well, instead of calling native.showPopup(“twitter”), I should use native.showPopup(“social”) and then, configure the Twitter actions in the options, as specified here ?

Thanks anyway, helps me a lot !

<evanspro>: No need to select Twitter on Android (if you do, it will have no effect). The system dialog appears, the user chooses. I’d again point you to the tutorial.

corona273 : thanks a lot, it now works fine ! I’m a little ashamed of myself, because I already read the tutorial you’re pointing, several times. And I still didn’t figure out what wasn’t working.

native.showPopup(“social”) do work fine and Android : the “share panel” shows correctly. I was “simply” correcting a function which was written… twice.

Thank you for your help, and your time !

My build.settings file has this entry for the social plugin:

 ["CoronaProvider.native.popup.social"] = { --required publisherId = "com.coronalabs", },

You have the extra line defining the platform. Maybe that’s the problem? Try taking that out and testing to see if it makes a difference.

<evanspro>: The problem you’ve encountered is that native.showPopup’s Twitter-specific functionality is available only on iOS (Corona’s docs could be clearer on this point).

On Android, you can pull up the standard system share panel that gives you access to Twitter and almost all the other apps that are registered with the OS. Unfortunately a big exception is Facebook sharing, which is broken but Corona is working on it: http://forums.coronalabs.com/topic/52755-can-corona-enable-limited-facebook-sharing-on-android-via-nativeshowpopup/

Do some searches in the docs and you’ll see how to use the Android share functionality.

And here’s an Android tutorial that Rob wrote: https://coronalabs.com/blog/2013/10/11/revisiting-the-social-plugin-now-on-android/

Alx@Panc : You’re right ! But I actually that line after trying once… just wanted to be sure !

corona273 : Oh… For sure, Corona’s doc should be definitely clearer on this point. So if I understand well, instead of calling native.showPopup(“twitter”), I should use native.showPopup(“social”) and then, configure the Twitter actions in the options, as specified here ?

Thanks anyway, helps me a lot !

<evanspro>: No need to select Twitter on Android (if you do, it will have no effect). The system dialog appears, the user chooses. I’d again point you to the tutorial.

corona273 : thanks a lot, it now works fine ! I’m a little ashamed of myself, because I already read the tutorial you’re pointing, several times. And I still didn’t figure out what wasn’t working.

native.showPopup(“social”) do work fine and Android : the “share panel” shows correctly. I was “simply” correcting a function which was written… twice.

Thank you for your help, and your time !