C/C++ iOS to Android - android-ndk

I have a game written in C/C++ for iOS (using only obj-c for the GLES initialization) and I would like to port it to Android, I saw that it was possible using the NDK by creating a dynamic library (.so).
I install the Android SDK and NDK compile a simple library load it run, no problem, but I simply can't debug it... I can only debug the Java part (where my GLES context is created etc...) Am I missing something or? how can I debug my dynamic library?
It doesn't seems to have no support for debugging anything created with the NDK for Eclipse... so how am I suppose to debug my C/C++ then?
Anybody have experience with this? Any help would be greatly appreciated!

You have to use ndk-gdb. Take a look at this articles:
http://groups.google.com/group/android-ndk/web/debugging-through-the-jni-with-android-2-2
http://www.eclipse.org/sequoyah/documentation/native_debug.php

Related

Possible to use a static library built from a different Android NDK?

The Android app I am working on is completely written in C++. I need to integrate it with a static library that also is written in C++. There is no dependency on STL in any of the projects.
The static library uses cmake to build. Unfortunately, the app is based on an old AOSP version of Android NDK and has no support for cmake.
I also have a newer version of Android NDK in a different directory. This version does support cmake toolchains.
I am thinking I will build the static library against the new NDK and use it in my main project. The ABI is the same for both the projects - armv7a.
I have tested this logic with a sample code. It seems to work. I am able to invoke methods in the static library from my main app.
Also, there are no name-mangling issues.
The question I have is if there is any issue I am overlooking.
I am thinking it should not matter that the compilers used to build the sources are different. As long as they are producing arm-compatible code, I should be able to able to integrate them.
As a matter of fact, another library that I am using, gstreamer, is available for download as pre-built binaries at https://gstreamer.freedesktop.org/data/pkg/android.
Please advice.
For those interested, mixing NDKs doesn't seem to be an issue as long as you follow certain guidelines. Some of them are listed at https://developer.android.com/ndk/guides/cpp-support.
Essentially, there is no problem if your project is 'C' based. However, if you are using C++, you must not use STL.
I have managed to build part of my code with two NDKs and I am not seeing any link time or runtime errors.

How can I use newlib with android NDK?

Can I use newlib or newlib-nano with android NDK to build a dynamic library?
I know this is not a to-the-point question. But couldn't find much write-up on this. Any help is appreciated. I'm a newbie to android.
Android uses bionic, not newlib. The C runtime is already loaded as part of the zygote in any app so this is not optional.

Does Kotlin provide any additional security?

When we develop an Android app in Java, we have the option to obfuscate the code and built the APK.
Is there any advance feature in Kotlin to do the same?
Code obfuscation is neither a Java feature nor a Kotlin one.
Since Kotlin is compiled to the same bytecode as Java, you can use the same tools (for example Proguard). Those tools obfuscate the bytecode and not the sources, I think you misunderstood that.
Suppose you're running gradle build on your Kotlin Android project. Then you'll find following tasks being run:
:app:compileReleaseKotlin
:app:compileReleaseJavaWithJavac
:app:copyReleaseKotlinClasses
:app:compileReleaseSources
:app:transformResourcesWithMergeJavaResForRelease
:app:transformClassesAndResourcesWithProguardForRelease
:app:transformClassesWithDexForRelease
As you can see Kotlin sources are compiled first, then the Java sources. This results in only one collection of Java classes which are processed with Proguard; just at the end. There is no differentiation between Java and Kotlin anymore at this step.

How do I generate .dSYM for MonoTouch app in Simulator?

I want to profile a MonoTouch application in Instruments without an iPad. I am able to profile an app compiled for Simulator but it's no fun without the symbols:
There is no option to generate IPA with dSYM in project build settings—looks like they're only available when compiling for the device.
All I want is a MonoTouch-aware dSYM for Simulator.
Is this possible?
This is unfortunately not possible, because in the simulator we JIT managed code. This means that it is not possible to know before executing the process where methods will be in memory, and Instruments doesn't support the required mechanisms for MonoTouch to inform about JIT'ed methods at runtime [1].
[1] See last comment on the response here: Is it possible to notify DTrace on Mac OS X of dynamically generated code?
Take a look at this - miguel wrote a blog post recently to compile aot for profiling on mac - I think this will give you what you're looking for:
Using Instruments to profile Mac apps built with Mono

Build libev on android ndk

I'm coding a program that really need libev (not libevent) on Android. I google many time to find how to build libev but unsuccess.
Could any one tell me, how to build libev on android. Thank so much.
Did you have any success? I'm stuck with the same problem, trying to use it on a native app for Android (working on Ubuntu). This article gave me some light:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#EMBEDDING
It might be useful for you. I tried the standalone case. In any case, I can't still make it work

Resources