How can i get android native java debuging codes with codenameone - java

is there a way or feature that give us possibility to see the native android codes after debugging the project with codenameone? right now we are just seeing the .apk file from the project not android java source.
I want to explore the android java source and editing them.

This is only useful for debugging, converting then using the sources is pointless as mentioned in the comments since the C code generated for iOS is not maintainable (its over 2000 files for a simple app).
To do this just use the include source feature: http://www.codenameone.com/how-do-i---use-the-include-sources-feature-to-debug-the-native-code-on-iosandroid-etc.html

Related

Using existing java code in Android Studio or eclipse

I am developing a word game. My aim is to have 90% of the code in pure Java, which is then referenced by Android Studio for an android app, by GWT to make a web solution and exported into objective C for iOS for the small amount of UI coding needed.
I have written all the code and I am only able to do this by manually copying the java classes between the projects. Clearly it must be possible as this seems such an obvious use case, but there does not seem to be a straightforward solution.
I realise I may be missing something. I have searched extensively, in particular the following:
Import source java project in Android project
Android studio add external project to build.gradle
Any help would be much appreciated.

source code for Codename.one generated apk file

i am using Codename.one for mobile apps development, once the build is submitted, they provide the "apk" file. Since there are some limitation in codename one, so i was wondering that is there a way to get the native code for android build. ??
You can get the sources using the include source feature (available for the basic 9 USD subscription) but you would be mistaken to use it for the case described.
You can extend Codename One in any way you want including with native code, there are quite a few cn1lib's most of which are open source which demonstrate rather easily how you can write native code in Codename One.
This is a superior approach since it keeps the portability of Codename One and easy development cycle while allowing you to do almost anything you need.
Notice you can look at the full source code of Codename One itself in its open source project page.

On/Off native support in project by one click

My project has next structure:
Java part for GUI
Native part(C++) for logic
they are connected by socket.
So, in development process I run native part on desktop computer and java part in android device. They connect by WiFi and it is very comfortable to debug every part.
But sometimes I need build full and all-sufficient .apk where native part included in it as .so libs and calling from java code.
For this reason I try to find a handy way to "ON and OFF" native support in project. Now I see only one way - comment/uncomment all in Android.mk(it is important to prevent including .so libs in apk because they are big) and comment/uncomment call of native finction in java.
But I don't like it...
Thank you!
What you describe looks like two different projects that share some (maybe much of) common code. You can easily have such setup in Eclipse, you can use linked folders to make source sharing between the two projects automatic. But it may be safer to use your source control's powers to maintain sync between sources for the two projects.

Porting C code to Android

I am at the very start of a project where we are trying to write an application for an android smartphone that will call a shared library written in C.
It seems that the way to do this is to use the Android NDK to build the library in a binary format compatible with the smartphone hardware then use JNI to call the shared library from Java. Possibly using SWIG along the way to facilitate with the JNI wrapper functions.
But before I go down this route, am I missing any, potentially much simpler, approaches to getting a C app to run on a smartphone? What got me thinking that there may be other alternatives was the Canonical project looking to run ubuntu on a smartphone (http://www.ubuntu.com/devices/android) but it doesn't seem to be available yet.
Any lateral thoughts on this topic gratefully received
As far as I know, the NDK is the preferred route to follow when using native code in android. You can also build a java wrapper library around your C code, separate from your Android project, and include that .jar in your Android app. This uses standard Java instead of Google's NDK, and I have used several libraries built in this manner in android with very little effort.

OpenFeint with cocos2d-x (iOS and Android)

Apparently OpenFeint supports both iOS and Android. Great.
But how do I integrate it with cocos2d-x Android? The SDK is, apparently a .jar and such. Cocos2d-x uses c++.
I don't get this tutorial: http://blog.molioapp.com/2011/11/openfeint-and-admob-integrated-with.html
I copy & paste the code and immediately I get errors (JavaVM *gJavaVM;? There is no identifier called that way!)
Are there any other steps not mentioned in that tutorial I missed?
Yes. In order to build a C++ library for Android you need to use the NDK. Getting that set up is pretty involved so I am just going to link you to a separate tutorial that has already covered it.
http://developer.android.com/sdk/ndk/index.html#installing
That is the Google documentation on getting up and running. There are other resources for this as well if you have trouble.

Categories