Android C++ Native Code - c++

I am a new Android developer and I would like to create an application using only C/C++ code for Android but I have found the documentation to be very limited. I can create an Android C/C++ project in eclipse, but it uses a lot of java code.
I'm using NativeActivity (new to 2.3) and I need help setting up my project. Does anyone know how to do this?
http://developer.android.com/reference/android/app/NativeActivity.html

Just remove all of the generated Java code. You don't need it if you want a purely native activity. The only thing you need to do is to set up the Android Manifest file as shown in the documentation. In particular, you'll need:
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="native-activity" />
And you'll need to modify jni/Android.mk so that it builds a jni with the name lib_name.

Yuo can look into the Lighthouse project for android, which allows you to use Qt (and therefore C++) code instead of java. You still need 1 line of java code to kick off your Qt app.

Related

Microsoft Visual cannot add tools

I´m new at Visual Studio C++ and maybe I´m asking a very trivial question. I have a project/application but I have to add a few new features to it. When I open the project in MVS and in "dialog" folder there are windows (or dialogs?) used by application and I can modify them but I´m not allowed to add components/tools that I really need. I have only Dialog editor tools unlocked. I can compile an run application but When I try to add a form to project I´ll see a message:
You are adding a CLR component to a native project. Your project will be converted to have Common language runtime support.
I´ve googled some information about .NET forms and windows dialogs, but I do not know what to do next. If I choose "yes" (convert project) I cannot compile it anymore.
What can I do if I would like to use a ZedGraph controll to plot graphs from data in this app?
The C# GUI tools are different to the C++ tools (like MFC).
When you try to add C# tools to a C++ project the IDE warns you "You are adding a CLR component..."
Depending on which IDE you are using, when you bring up the resource view (http://msdn.microsoft.com/en-us/library/d4cfawwc.aspx) e.g. with ctrl + shift + E you should be able to find the existing dialogs and double click to edit them.
It seems that ZedGraph is a C# library (from the docs), so you will have to convert into a C# project in order to use it, which will not be straightforward, or use a suitable C++ one.

Developing for BlackBerry with IntelliJ

I wonder if someone has idea about next.
I'm developing for BlackBerry. IDEA doesn't recognize RIM installation as JSDK or Mobile SDK. So I have create project without SDK and attach RIM jar file as dependency.
I'm trying to write as much as possible unit test with JUnit and Mockito but to run them IDEA requires JSDK. So I created additional module where I set JSDK, correct language level and it works. It's already hassle to create additional module (better if we could set JSDK and other compiler, runtime options for code and tests) but I was quite happy.
I have also dependencies for some common libraries which we use in android and J2ME also. I added them as modules with JSDK 1.6 and language level 1.3. And I able to develop and run test on it also.
But I got issue with LEDA EAP. IDEA now complaints about incompatibility with java.lang because it found them both in RIM jar and JSDK for libraries. And now I'm thinking about next hassle to fix my favorite ide. Sure it's EAP and things could be changed.
But anyone has any recommendation or similar situation setup?

how to create installer file

I am currectly finishing my project in C++ and i'm looking for a way to create my own C++ installer file
which will create the project dll's and exe files into a specific path
what is the easier way to learn how to do it?
There are several ways to build an installer. While you can of course always make one yourself, you should google for something like "create an installer". Some prebuilt solutions include "InstallShield", or the ".msi" file format, which you can create on your own using something like "Advanced Installer".
Of course, if you want your users to build your project from source, then you need a makefile and to make sure you bundle all the libraries. There are also kits like autotools to do that for you.
If you use VS 2010, Installshield LE would suffice as it is integrated into VS 2010.
If you have access to Installshield IDE, there is nothing better available for your packaging needs.
There are two ways of packaging:
a) The LEGACY way
b) The Windows Installer way, Basic MSI is the keyword here.
The LEGACY way involves creating your own scripts for:
a) Installing the files to their locations
b) Writing registry entries, if needed
c) Registering COM components, if needed
d) Creating shortcuts etc...
Tools that can be used for LEGACY approach are:
a) NSIS - very good and has a scripting language of its own.
b) Installshield - has a project type called Installscript Project. Installscript is the scripting language to be used.
The Windows Installer way is a bit hard comapred to the LEGACY way.
One has to learn the basics of MSI technology which can be daunting.
The package created has .msi as extension. This file is a database that the developer configures and the Windows Installer takes care of all other things. This is called TRANSACTIONAL installation procedure.
Even the UI presented during install is configured in the Database using tables like Dialog, Controls etc...
Tools that can be used for Windows Installer approach are:
a) Installshield - has a project type called Basic MSI
b) Wix - Opensource and xml based. You configure appropriately named xml files and various utilities in the Wix package will help you to create an MSI package.
First after completing your project click save. Second click on file tab,Add,New Project.
In new Project Click other Project types , Setup and Deployment and in that You can click InstallShield LE or Visual Studio Installer.
Hope this Helped you
I always recommend NSIS. You might also investigate HM Nis Edit - it's an IDE for NSIS that has a useful wizard feature. It will generate an installer script for you which you can further customize. The documentation is extensive.
can't believe no one mentioned install creator pro(there is also a free version with a branded message that displays after installing). Its feature set is pretty limited, though it has options for writing registry values and specifying custom paths to %AppData% or any other place you may want to install some files. it also has an optional wizard interface, and with each step you have the oppurtunity to preview each individual page.
the paid version offers the option for adding serial number/registration to your program. i've never tried it so i'm not sure how effective it may be. its also quite and expensive little program, but i would recommend it atleast to the beginner or someone who is more concerned with maintaining the codebase of their program and less concerned with how fancy and decorated their installer program is.
i know its been a long time since this was posted but for future reference this program is far easier for any beginner to creating installation packages for the first time

Way to debug mixed JNI code?

I've been looking around to find an easy way to debug my JNI code, you know, to be able to freely jump into native code and back into java code.
The solutions which I found were sort of out of date or got some restrictions. Some required specific ndk version, some required specific Eclipse version. Here my target is Android 1.6 & 2.2, I'm using Eclipse 3.6 Helios, and NDK r5b. Is there a general solution for this mixed debugging? Thx.
Citate from $NDK/docs/NDK-GDB.html:
IMPORTANT: Native debugging can only work if all these conditions are met:
1. Your application is built with the 'ndk-build' script:
Building with the legacy "make APP=<name>" method is not
supported by ndk-gdb.
2. Your application is debuggable:
In other words, your AndroidManifest.xml has an <application>
element that sets the android:debuggable attribute to "true"
3. You are running your application on Android 2.2 (or higher):
ndk-gdb will not work if you try to run your application on
previous versions of the system. That does not mean that your
application should target the Android 2.2. API level, just
that the debugging session should happen on a 2.2+ device or
emulator system image.
so, you can't use device with 1.6.
How to setup environment to debug jni code: i used this recipe, it works for me.

c++ invisible app that launches an exe using native libraries

I'll begin with an apology since I am new to c++ and maybe my questions make no sense.
I have a c# app, unfortunately it requires .Net framework to be installed on the machine.
I'd like to make a c++ application that will copy a .Net installer from a cd, and run the installer on quite mode.
The c++ app must be hidden, no console or what so ever, and also the most important thing is: it must run on a clean install of windows xp/
Please help me :)
I have no idea how to approach this, since I've never used c++ before.
P.S. (if it's possible to run a c# app that can do the above, saying how would be appreciated).
I tried googling but failed to get an answer
I dont know why you want to have a c++ app to launch the dot net installer. This can be achieved from within DOT NET env itself.
Add a Setup project to your current solution. It can detect installed .net framework and depending on your application's dependencies can offer to install one automatically.
However by default it will try to download the framework but if you intend to supply it on your CD you can configure it to pick up the installer from a local location as well.
Refer here to get you started
http://support.microsoft.com/kb/307353