Sign in to follow this  
mychii

Trouble on setting up environment using Android NDK with native activity

Recommended Posts

Hi guys,

 

I'm having trouble on setting up the environment Android NDK using native activity. I've googled anything and found have many ways to do it, and most often I got stuck with the ones without native activity, or just setting up the native activity instead of explaining things. There's just no complete guide on telling how to setup from scratch, how to deal with the files, tools (compilers and stuff), and their configuration files. I tried the Android Studio 2.2 and it gives even more hell with its Gradle more than its mk files.

 

For example, I don't even know how I can insert their native library (in Android Nougat) like Vulkan. I tried adding the vulkan.h, it doesn't work. Found its header file in its ndk files, and I don't know how to insert it. Tried to mess up with its Gradle, it gives even more error I don't understand, like missing dependencies, ndk-experimental version issues, etc. There's just too much integrated techs that I don't get there.

 

The environment setup for Android is just really, really, hard for me, especially when I need to find anything straightforward for gamedev from scratch to screen; adding internal and external libraries, compiling my files. Does anyone has any resources related for this from ground up? or quick guide on where I should start? It doesn't matter if it's from ndk-build or command lines.

 

I have my game codes and I want to make it cross-platform, but really, this is the hardest environment setup I have yet. :wacko:

Share this post


Link to post
Share on other sites

You mention Vulkan, if that's where you're going, then you might be best to look for Vulkan samples because they're all based on Native Activity.

 

But, are you sure you even want to use a NativeActivity? If your game is going to end up including lots of common stuff like IAPs, Ad Networks, Analytics, Google Play Games. Social Media integration, you'll find that all the available libs are Java based, and that a Native Activity project might not be the ideal choice for you. It's not necessarily impossible to integrate these things into a native activity, but a Java based app calling into C/C++ native library is the easier way to go if you're likely to end up integrating a lot of java libs.

 

Finally, if you're particularly keen on the Visual Studio environment then you could do worse than looking into NVidia's NSight Tegra stuff.

Edited by C0lumbo

Share this post


Link to post
Share on other sites

Yeah I've tried the Vulkan samples but it didn't run. This is one of the guide I tried, compiling the ndk through ndk-build using r12 NDK, which also led me to use Android Studio. but the compilation breaks, like some stuff are missing that I don't know, and that involves the Gradle. Not to mention some of its versions (especially the Android Studio and its ndk-experimental whatever is kind of different and throw different errors), and I don't seem to find any other alternative to seek solution upon those errors. It's as if I have to wait for it to be stable first.

May not be the main issue, but just a little rant that setting up the mk files and the gradle are also way more confusing than I thought.

Okay, Actually what led me to use NativeActivity is because of the Vulkan examples (including example from SaschaWillems). I thought it'd be nice if everything is based on C++ so I can easily integrate my core codes, and I thought the Vulkan can only be integrated if and only if I'm using NativeActivity, I can be wrong in this part. I'll be looking upon this, and it'd be great if you can tell me some direct resources on where I could start.

 

As for their API, I haven't get to there yet for Android but I can use JNI right? I have my architecture to handle this kind of issue (same goes to iOS build with its Objective-C and other build), and I'll get to this too later, but I think it'd be a diff topic.

Share this post


Link to post
Share on other sites
Check out my repo about vulkan and android ndk. https://github.com/MonkeyD-IchiJou/LunaProject
Yes, it is difficult to understand the whole ndk thingy. All I did was to read some ndk guide books and then trial and error. Android mk and application mk is the most important, because it tells the ndk where your source files are and how it will compile.. try to do it wih command line first, because android studio and its graddle makes things complicated

Share this post


Link to post
Share on other sites

Ahh thanks for recommending me with the command line. I should've search that in the first place.

It's way simpler to focus on learning how to use the mk files and do my own manual shell scripts than learning the freaking gradle and the studio whatever. I really just need to compile it to Android with my codes that happen to be in C++.

 

Thanks for the link as well. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this