Today I purchased Android tablet for native development -- Acer Iconina Tab A500 (Honeycomb 3.1) powered with Tegra.
Then I downloaded and installed Tegra Android Development Pack (Windows and Mac) from from http://developer.nvidia.com/tegra-android-development-pack. Of course I turned on 'USB debugging' in the Application settings.
I tried to debug sample apps (like es2_globe) by 'Debug As -> Android NDK Application' menu command but after building -- nothing happens.
Application does not start. But if I choose 'Debug As -> Android Application' or 'Run As -> Android Application' -- everything fine.
Same situation on Mac and Windows.
So, what should I do in order to make NDK debug work ?
Here can be various reasons why your application was not started, and you can see what is wrong in console output, like in the following example where gdbserver was not successfully run and this situation can be fixed rooting device.
[2011-11-03 22:01:58 - testndk] NDK: NVIDIA Debug Manager for Android NDK!
[2011-11-03 22:01:58 - testndk] NDK: adb is running normally...
[2011-11-03 22:01:58 - testndk] NDK: Performing com.xxx.android.testndk.TestNdkActivity activity launch
[2011-11-03 22:01:58 - testndk] NDK: Automatic Target Mode: using device 'HT09AP801162'
[2011-11-03 22:01:58 - testndk] NDK: Check if there arealready running gdbservers 0.079
[2011-11-03 22:01:58 - testndk] NDK: Running gdbserver processes not found.
[2011-11-03 22:01:58 - testndk] NDK: Check if there is running application com.xxx.android.testndk 0.188
[2011-11-03 22:01:58 - testndk] NDK: Running application is not found
[2011-11-03 22:01:58 - testndk] NDK: Uninstalling package com.xxx.android.testndk 0.282
[2011-11-03 22:02:00 - testndk] NDK: Syncing app 1.469
[2011-11-03 22:02:00 - testndk] NDK: Uploading testndk.apk onto device 'HT09AP801162'
[2011-11-03 22:02:00 - testndk] NDK: Installing testndk.apk...
[2011-11-03 22:02:01 - testndk] NDK: Success!
[2011-11-03 22:02:02 - testndk] NDK: Launching app 3.329
[2011-11-03 22:02:02 - testndk] NDK: Starting activity
com.xxx.android.testndk.TestNdkActivity on device
[2011-11-03 22:02:02 - testndk] NDK: Executing shell command: am start -D -n com.xxx.android.testndk/com.xxx.android.testndk.TestNdkActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
[2011-11-03 22:02:02 - testndk] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.xxx.android.testndk/.TestNdkActivity }
[2011-11-03 22:02:02 - testndk] NDK: Waiting 3 seconds for application to start 3.891
[2011-11-03 22:02:02 - testndk] NDK: Attempting to connect debugger to 'com.xxx.android.testndk' on port 8602
[2011-11-03 22:02:05 - testndk] NDK: Performing port forwarding 6.891
[2011-11-03 22:02:05 - testndk] NDK: Computing PID of launched application 6.907
[2011-11-03 22:02:05 - testndk] NDK: Found PID of launched application: 1308
[2011-11-03 22:02:05 - testndk] NDK: Starting up gdbserver :12345 --attach 1308 7.016
[2011-11-03 22:02:05 - testndk] GdbServerReceiver: gdbserver: permission denied
[2011-11-03 22:02:12 - testndk] NDK: Gdbserver not started properly
There are many reason why Native Debug may not work. You may try the following:
- I could only debug native using ndk version r8d, previous versions gave many difficulties
- Check in console view if there are any errors during compilation time or during synchronization with device
- Sometimes there is a error that says "gdbserver segmentation fault". Verify that you are compiling with NDK_DEBUG = 1. Also try in another device, sometimes the device is the one with the problem.
- Open the apk inside bin folder, and verify that there is a gdbserver and a gdb.setup in addition to your normal .so file
- Just in case, check that you have the debug flag in true in the manifest
- somethings restarting adb and disconnecting reconnecting the device helps.
For more detail info you could post the errors that your console view displays.