I want to use twitter but error happened on android

The error says “fatal signal 11 android code=1”.
Incidentally, iOS emulator can tweet.

This is my code.

GameScene.cpp

void GameScene::tweeting(){
    NativeLauncher::openTweetDialog("tweet test \n#test");
}

NativeLauncher.h

#ifndef GuruguruNumber_NativeLauncher_h
#define GuruguruNumber_NativeLauncher_h

class NativeLauncher{
public:
    static void openTweetDialog(const char* $tweet);
};

#endif

NativeLauncher.mm

#import "NativeLauncher.h"
#include "NativeLauncher.h"
#import <Twitter/Twitter.h>
//using namespace Cocos2dExt;
void NativeLauncher::openTweetDialog(const char *$tweet){
    NSString* tweet = [NSString stringWithUTF8String:$tweet];
    if([TWTweetComposeViewController canSendTweet]){
        UIViewController *myViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
        TWTweetComposeViewController *twitterVC = [[TWTweetComposeViewController alloc]init];
        [twitterVC setInitialText: tweet];
        
        twitterVC.completionHandler = ^(TWTweetComposeViewControllerResult res){
            [myViewController dismissViewControllerAnimated:YES completion: nil];
        };
        
        [myViewController presentViewController: twitterVC animated:YES completion: nil];
    }else{
        tweet = [NSString stringWithFormat: @"%@%@",@"http://twitter.com/intent/tweet?text=",tweet];
        tweet = [tweet stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        [[UIApplication sharedApplication]openURL:[NSURL URLWithString:tweet]];
    }
    tweet = nil;
}

NativeLauncher.cpp

#include "NativeLauncher.h"
#include <jni.h>
#include "platform/android/jni/JniHelper.h"
#define JNICLASSNAME "jp/brbranch/lib/Cocos2dxMyActivity"
#define TWEET "tweet"

using namespace cocos2d;
void NativeLauncher::openTweetDialog(const char* $tweet){
    JniMethodInfo methodInfo;
    if(JniHelper::getStaticMethodInfo(methodInfo , JNICLASSNAME , TWEET , "(Ljava/lang/String;)V")){
        jstring str = methodInfo.env->NewStringUTF($tweet);
        methodInfo.env->CallStaticVoidMethod(methodInfo.classID , methodInfo.methodID , str);
        methodInfo.env->DeleteLocalRef(str);
        methodInfo.env->DeleteLocalRef(methodInfo.classID);
    }
}

project.java

package package.project;

import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

import ...

public class GuruguruNumber extends Cocos2dxActivity{
	
	static Cocos2dxActivity my;
    protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);	
		my = this;
                ......
	}
    ......
    public static void tweet(String $msg){
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, $msg);
        my.startActivity(intent);
    }

    public Cocos2dxGLSurfaceView onCreateView() {
    	Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    	// GuruguruNumber should create stencil buffer
    	glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
    	
    	return glSurfaceView;
    }

    protected void onDestroy(){
    	super.onDestroy();
    }

    static {
        System.loadLibrary("cocos2dcpp");
    }     

}

please help me! :frowning:

I appreciate your help.
And, please do not mind sense of discomfort of my English.

It looks like the problem here is JNICLASSNAME.

It’s defined as “Cocos2dxMyActivity” but your tweet() method is a member of GuruguruNumber.

You probably want “package/project/GuruguruNumber” in the call to getStaticMethodInfo

It works perfectly!!

thanks a million !!