Jump to content
  • Advertisement
Sign in to follow this  
????????? ????????

IDE for Android NDK

This topic is 940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

When working with NDK you can use actually any C++ IDE. For me it was a requirement to develop under Linux so I found QtCreator really great to work with NDK. I use neither AndroidStudio nor Eclipse. For Java side ( you may still need some Java code ) I use Netbeans which, comparing to "bloatware" Eclipse, is just lesser of two evils in my opinion, but again - it allows to create freeform project. The major problem you may find is native code debugging. I'm not sure about current AndroidStudio, but in the past both AS and Eclipse couldn't handle native debugger. It was incredibly sluggish, unstable and pretty much useless. In QtCreator it's trivial to setup Android debugging ( especially that QtCreator support Android development ). I know there are solutions for Visual Studio etc. but I haven't had chance to work with it.

Edited by j_uk_dev

Share this post


Link to post
Share on other sites

Eclipse is only one good solution at this moment. It can handle both Java and C/C++ NDK debugging (breakpoints, variables etc) with free ARM DS-5 Community Edition plugin (caution: it does not works with latest Mars Eclipse release, only with previous Luna 4.4). Only one problem, its not working out-of-box and requires some time to configure and tune it.


84
Edited by hutchdog

Share this post


Link to post
Share on other sites

I use NSight Tegra (which plugs into Visual Studio): https://developer.nvidia.com/nvidia-nsight-tegra

 

When it works, it's great. When it's not working or you're struggling to plug in some new library, it can be very frustrating because all the online tips and tutorials are geared around eclipse and Android Studio.

Edited by C0lumbo

Share this post


Link to post
Share on other sites

I started using vs 2015. It supports ndk debugging, and the emulator is smooth and fast.


VS 2015 works great for me, although I pretty much just using it for intellisense when it comes to android. The emulator can't run opengl calls for me and the NDK debugging part won't work cause my device is too old. Otherwise awesome smile.png Edited by noodleBowl

Share this post


Link to post
Share on other sites

Go check this: https://sites.google.com/site/customprog/home/setup-eclipse-for-android-c-java i didn't fix the ingeridients etc so it won't appear as gd.net article but i made it avail on my site, theres full guide how to set up Eclipse for making native apps, after that you need to read this: this is important it will tell you how to setup the project to be used for NDK theres something to be clicked, however it shows how to setup opengl in java and call in c++ code from it, but theres alot of articles how to make native activity on the web (so you dont need to use java crap - but its helpful)

http://www.learnopengles.com/android-lesson-one-getting-started/

 

if you went through calling c++ code from java theres a catch on the site above because making jni.h file by the exe provided in java sdk wont work you need to write that by yourself (something is crapping out with extern C {} in the header file:

 

here is the code (it doesnt really need to be named jni.h but the main cpp file is the first you define in android.mk

#include <jni.h>
#include "main.h"
#include "game.h"

//#include "FileHandling.h"


std::string PEBOL_ZAZNACZYC;
std::string PEBOL_IP;
extern "C" {

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonSurfaceCreated(JNIEnv * env, jclass jsc);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonSurfaceChanged(JNIEnv * env, jclass cls, jint width, jint height);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonDrawFrame(JNIEnv * env, jclass cls);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonMouseDown(JNIEnv * env, jclass cls, jfloat x, jfloat y);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonMouseMove(JNIEnv * env, jclass cls, jfloat x, jfloat y);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonMouseUp(JNIEnv * env, jclass cls, jfloat x, jfloat y);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetAppDirectory(JNIEnv * env, jclass cls, jstring str);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetAppScreenSize(JNIEnv * end, jclass cls, jint w, jint h);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetIPnumber(JNIEnv * env, jclass cls, jstring str);
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetEnviroment(JNIEnv * env, jclass cls, jint str);
};


void MakeEnv(JNIEnv * env)
{
	SetAppEnviroment(env);
}

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetEnviroment(JNIEnv * env, jclass cls, jint str)
{
	MakeEnv(env);
}

void SurfCreationEvent()
{
	glInit();//call from game.h
}

void ProcessMe()
{
	ProcessFrame();//call from game.h
}

void EventOnMouseDown(float x, float y)
{
OnMouseDown(x, y);
}

void EventOnMouseMove(float x, float y)
{
OnMouseMove(x, y);
}

void EventOnMouseUp(float x, float y)
{
OnMouseUp(x, y);
}

void SetAppDir(std::string p)
{
SetApplicationDirectory(p);
}


void SetAppScrSize(int w, int h)
{
	SetApplicationScreenSize(w,h);
}

void SetAppIP(std::string str)
{
	SetAppIPAddr(str);
}

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetIPnumber(JNIEnv * env, jclass cls, jstring str)
{
	const char *nativeString = env->GetStringUTFChars(str, JNI_FALSE);
	PEBOL_IP = nativeString;
	env->ReleaseStringUTFChars(str, nativeString);

	SetAppIP(PEBOL_IP);
}

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonSurfaceChanged(JNIEnv * env, jclass cls, jint width, jint height)
{}

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonDrawFrame(JNIEnv * env, jclass cls)
{
	ProcessMe();
}


JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonSurfaceCreated(JNIEnv * env, jclass jsc)
{
	SurfCreationEvent();
}

//----------------Touch input------------------
JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonMouseDown(JNIEnv * env, jclass cls, jfloat x, jfloat y)
{
EventOnMouseDown(x, y);
}

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonMouseMove(JNIEnv * env, jclass cls, jfloat x, jfloat y)
{
EventOnMouseMove(x, y);
}

JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PonMouseUp(JNIEnv * env, jclass cls, jfloat x, jfloat y)
{
EventOnMouseUp(x, y);
}


JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetAppDirectory(JNIEnv * env, jclass cls, jstring str)
{
	const char *nativeString = env->GetStringUTFChars(str, JNI_FALSE);
	PEBOL_ZAZNACZYC = nativeString;
	env->ReleaseStringUTFChars(str, nativeString);

	SetAppDir(PEBOL_ZAZNACZYC);

}


JNIEXPORT void JNICALL Java_com_example_wirednavalbattle_GameLibJNIWrapper_PSetAppScreenSize(JNIEnv * end, jclass cls, jint w, jint h)
{
	SetAppScrSize(w, h);
}

#ifndef mainH
#define mainH
//#include <android/log.h>

#include <string>
#include "glwrapper.h"
#include <math.h>

#endif
 

you see there that i call functions in main.cpp file that call functions from game.h its needed for normal working.

 

you also see that it inculdes jni.h i think its needed, even when jni.h is not present in the project at all :)

Edited by WiredCat

Share this post


Link to post
Share on other sites

My experience is that the official AndroidStudio is one of the better options here (though I haven't used Visual Studio for Android native development).

 

The gradle configuration for native is a tad under-documented, but it is all there and supported.

Share this post


Link to post
Share on other sites

I'm just using the command line, and ant that comes with the old Eclipse IDE.

Not actually using Eclipse, except when debugging some java code. You can write your code in whatever IDE you favor.

 

 

 

 


The gradle configuration for native is a tad under-documented, but it is all there and supported.

 

Worst part I think is that its not just under-documented, it is also unfinished and the documentation explicitly states that basically everything is bound to change.

I don't have time to update my project at random intervals whenever they decide to change something that breaks my build, so I stick with the old system until they sort out their stuff... Maybe they'll get it done in a few years, if they don't decide to change IDE again and start over before they finish...

Edited by Olof Hedman

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!