Hi iam new in Android and I am facing a problem in creating new project. After clicking finish button I am getting error as follow.
Failed to load properties file for project 'VDemo'
I got this in groups.google.com.See here
Here you have to set the environmental path's system variables. Which will
you get by *right clicking on My Computer properties Advanced Environmental
variables. *
** Then you select path option from System Variables* *and
select Edit option. Then u have to mentioned the *jdk's path as follows.
C:\Program Files\Java\jdk1.6.0_14\bin *after that give semi colon and set
the avd file path.
*
*
*C:\Documents and Settings\tpbhade.android\avd like this.** *Give the
semicolon. and click on ok button. Then u restart u r Eclipse. and go to
project menu unchecked Build Automatically option, and click on Build all
option. your problem will be solved.
Related
I have such exaption
InvalidPathException: Illegal char at index 9: C:\Users\??????\.android\avd\1.avd (show balloon)
when trying to create emulator. Can I change the location of directory .android?
Open control panel
Then go to System
Then go to Change Environment Variables of the User
Then click create a new environment variables
Create a new variable named ANDROID_SDK_HOME
Set its value to your Android directory, like
C:/users/<username>/.android
I tried suggested solution but did not work for me.
In my case I have to add a different variable so steps for me were:
Open Control Panel
Then go to System and Security
Then go to System
Then go to Advanced system settings
Then go to Change Environment Variables of the User
Then click create a new environment variables
Create a new variable named ANDROID_AVD_HOME
Set its value to your Android directory, like C:/users/<username>/.android
How can I change the path to android\avd in my Android Studio ?
Let say you want to move avd directory from it's default C:\users\<username>\.android\avd to D:\Development\avd
Move avd directory to desired location (ex. D:\Development\avd)
Change or add environment variable ANDROID_AVD_HOME : D:\Development\avd
On Windows: Control Panel > System > Advanced system settings > Environment Variables
If variable doesn't exits Click New... and fill with aforementioned data.
If variable exists then select variable, click on Edit... and replace variable value with the new path (ex. D:\Development\avd)
If you have already AVD, change avdName.ini to D:\Development\avd\avdName (ex. D:\Development\avd\Nexus_S_API_22.avd)
There is a simple way to move avd(in windows):
open the directory: C:\Users\Username\.android\avd, you will find the directory named with your AVD and a .ini file
move the directory to your desirable path, then change the path variable in the .ini file to the new location.
start the Android studio, you will find that the AVD can work properly.
Just move the emulator folder(folder that ends with .avd) to new location and keep the .ini file in same location then change the path to new location in .ini file.
No environment variable needed to be changed or added.
old path
path=C:\Users\nero\.android\avd\Android_Q.avd
new path
path=D:\androidemuators\avd\Android_Q.avd
You can keep your emulator anywhere just need to tell .ini config file where your emulator is located.
Simple with Image solution here, no need to edit Environment Variables here.
Go to C:\Users\<PCname>\.android and move the avd folder to
your desired location. Example D:\Programming\Android Studio\avd
Open avd folder and edit every .ini files, each one of these is represent to your emulator.
Edit file location. See image below for your reference.
Restart your Android Studio.
These are .ini files:
Old path:
New path:
Had the same problem. The reason was that ANDROID_AVD_HOME pointed to my user directory which had a space and umlaut in it. Obviously that causes some trouble with Android Studio.
So defining a system wide ANDROID_AVD_HOME point to d:\development\avd\ solved the problem.
I have question about error while importing import.hello.Hello in android studio, as you see in the picture below. please give me solution how to solve this error
See here #Arpit Patel answer You need to set the path like that
As you told you have 64 bit system then copy this path C:\Program Files\Java\jdk1.8.0_31
Step 1 :- Create JAVA_HOME variable by clicking new and past ( C:\Program Files\Java\jdk1.8.0_31) this path.
Step 2 Then click path variable and edit then past it your path after add semicolon (;) C:\Program Files\Java\jdk1.8.0_31
I am using windows 10 so this windows look like this
Note :- If above dialog not open then
, select path variable and click on Edit…. Locate the end of the current variable value
append the path of jdk, using a semicolon And click ok
I am installing Android Studio and I have by default the path C:\Users\Administrator\AppData\Local\Android\sdk to set my SDK. If I choose this option, some folders appeared on the path C:\Users\Administrator.
These folders are:
.android
.AndroidStudio1.3
.oracle_jre_usage
.gradle
To be a little more cleaner I tried to wrap all these folders into another folder but each time I run Android Studio it gives to me the option to configure again the settings. If I configure them again, the folders re-appeared on the path C:\Users\Administrator.
What can I do to wrap these folders into another one or to set another location for them and that the settings will be saved?
EDIT: I prove the solutions on the blog of the answer provided by Rahul Tiwari but I only could get that the folder .android will be in the new folder. The rest folders are at the same location after the changes.
EDIT 2: According to the blog provided by Rahul Tiwari to move the folder .gradle I change the default settings of Android Studio:
File > Other Settings... > Default Settings... > Build, Execution, Deployment > Gradle
Here I have as Service directory path: C:/Users/Administrator/AndroidStudio/.gradle
But the folder .gradle still appears on the path C:/Users/Administrator.
EDIT 3: Trying to remove the folder .AndroidStudio1.3 I changed these lines:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.plugins.path=${idea.config.path}/plugins
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.log.path=${idea.system.path}/log
to these:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
idea.plugins.path=${C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/config}/plugins
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
idea.log.path=${C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/system}/log
but I also couldn't move the folder.
EDIT 4: This is the blog that I mention before (Thank you very much Rahul Tiwari). I post it here because his answer was deleted.
Thanks in advance!
Finally, I got the solution to move three of the folders that I put above. I think it could be interesting to put here the problems that I faced and the changes that I made to solve them.
I'm going to investigate about the last folder, .oracle_jre_usage, and I will complete this answer if I got a solution for it. Look that I complete the solution for .gradle folder.
To move .android folder
Really, following the steps of the blog that Rahul Tiwari provided, this folder could been moved. Nevertheless I'm going to put here all the process:
You have to move your .android folder, after closing Android Studio (if you have it running), to the folder in which you want that it will be stored, in my case, C:\Users\Administrator\AndroidStudio.
BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean, Android Studio, New Folder or similars.
If you are on Windows, you can do right-click on My Computer > Properties > Advanced System Settings > Environment Variables and create a new environment variable named ANDROID_SDK_HOME and as value you have to put the new path in which .android folder will be stored. It's the same path in which you have moved the .android folder in the step above.
Click "OK" button to accept your changes.
Re-launch Android Studio and look that the .android folder doesn't appear in the default path.
To move .AndroidStudio1.3 folder
With that folder I had some problems because I didn't noticed some details that were very important. Here the steps that I followed:
First of all, you have to close Android Studio before doing any change.
After, you have to move the folder .AndroidStudio1.3 to the path in which you want that it will be stored.
Next, you have to go to the folder in which Android Studio were installed and open "idea.properties" file and changed the lines where idea.config.path and idea.system.path appeared for the new path in which these folders are going to be located.
They have to be something similar to this:
idea.config.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/config
idea.system.path=C:/Users/Administrator/AndroidStudio/.AndroidStudio1.3/system
Here I had three problems so please be careful:
Notice that the paths are with / and not with \ as Windows put by default.
DON'T CHANGE the values of idea.plugins.path and idea.log.path (My EDIT 3). Be sure that you are changing idea.config.path and idea.system.path values.
Uncomment the lines in which idea.config.path and idea.system.path appears. I mean, remove the # that they have at the begining of each line.
The last step, re-launch Android Studio.
Searching and doing some proves I also get the solution to move .gradle folder. The steps are the same as .android folder but I put here all the steps (with the values that changed) to avoid any confusion. Here it is:
To move .gradle folder
You have to move your .gradle folder, after closing Android Studio (if you have it running), to the folder in which you want that it will be stored, in my case, C:\Users\Administrator\AndroidStudio\.gradle.
BEWARE WITH THE SPACES IN THE NAME OF THE NEW FOLDER, IT COULD GIVE TO YOU PROBLEMS (AS ME). I mean, Android Studio, New Folder or similars.
If you are on Windows, you can do right-click on My Computer > Properties > Advanced System Settings > Environment Variables and create a new environment variable named GRADLE_USER_HOME and as value you have to put the new path in which .gradle folder will be stored. It's the same path in which you have moved the .gradle folder in the step above.
Click "OK" button to accept your changes.
Re-launch Android Studio and look that the .gradle folder doesn't appear in the default path.
How to move data from %UserProfile%
The folders will still remain under %UserProfile%, but not the data.
Move .android
Android Studio is closed
Add Environment Variable
Create "System variable":
Variable name: ANDROID_SDK_HOME
Variable value: D:\Android
Move .AndroidStudio
This is a example with Android Studio version 3.1
Start Android Studio
Help -> Edit Custom Properties...
Click Yes to create file
Edit file with:
idea.config.path=D:/Android/.AndroidStudio3.1/config
idea.system.path=D:/Android/.AndroidStudio3.1/system
The file "idea.properties" is located under:
%UserProfile%/.AndroidStudio3.1/config
Close Android Studio
Delete all under %UserProfile%/.AndroidStudio3.1 except the file "/config/idea.properties"
Optional: Delete older version folders of .AndroidStudio
Don't edit "Android Studio/bin/idea.properties". When updating Android Studio this file is cleared.
Move .gradle
Start Android Studio
File -> Settings... -> Gradle
Change "Service directory path" to:
D:/Android/.gradle
Update Android Studio
Start Android Studio
"Import Studio settings from" is showed
Select: D:/Android/.AndroidStudio3.0/config
I think most of the others answers address the issue, But I found more simple way for windows by adding few environment variables . (Might work for mac as well, I didn't test though)
ANDROID_SDK_ROOT - path to the SDK installation directory
default path - C:\Users\XXXX\AppData\Local\Android\Sdk
Add enviroment variable ANDROID_SDK_ROOT - set value to desired location
Eg: =E:\Android\local\Android\Sdk
For .android folder
default path - C:\Users\XXXX\.android
Add enviroment variable ANDROID_SDK_HOME- set value to desired location
Eg: = E:\Android
For .gradle folder
default path - C:\Users\XXXX\.gradle
Add enviroment variable GRADLE_USER_HOME - set value to desired location
Eg: = E:\Android\.gradle
For .androidstudioXXX
Android Studio-> Help-> Edit Custom Properties
Add below lines
idea.config.path=E:/Android/.AndroidStudio4.0/config
idea.system.path=E:/Android/.AndroidStudio4.0/system
Add environment variable STUDIO_PROPERTIES - set value to desired location
Eg: = E:\Android\idea.properties
Finally don't forget to copy files from the original location to the new location.
Source : https://developer.android.com/studio/command-line/variables
Please see the end of the page to know how to add the environment variable on Windows, Mac or Linux
At least for Android 3.0 the steps in the accepted solution are not enough to be able to run the emulators after moving the .android folder (let's say you moved the folder from c:\Users\<username>\.android to I:\Programs\AppData\.android).
In addition you need to
Copy (or leave) files adbkey and adbkey.pub in old location (i.e. c:\Users\<username>\.android\adbkey, c:\Users\<username>\.android\adbkey.pub)
Replace the old location path string C:\Users\<username>\ in all .INI files found in the new avd location (i.e. in I:\Programs\AppData\.android\avd) with the new location path string I:\Programme\AppData\
Delete all *.qcow2 files from the new avd location (i:\Programme\AppData\.android\avd) which contain the old location path string c:\Users\<username>\. Check Qcow2-files refer to incorrect/nonexistent base-images for an alternative to delete the *.qcow2 files. If you delete the files all data in the emulator is lost, in this case you will get a clean version of Android, like after a hard reset.
To change default .gradle folder using Android Studio 2.2
Open folder of .AndroidStudiox.x (x.x is the version you use) -> config -> options -> gradle.settings.xml file
just right click to open it with wordpad, you should only see 1 option name = serviceDirectoryPath, change the value of that to desired path
remember use / not backward slash \ for folder even in Windows OS
I use junction.exe from Sysinternals to make my Java/Android Studio fully "portable" in Windows:
I have "AndroidStudio" installed in a folder "work".
I have "Java\jdk1.8.0_77_x64" in the same "work".
In the same folder "work" I copied the original ".android", ".AndroidStudio2.2" and ".gradle" folders (from C:\Users\<YourProfile>).
Then in the same parent folder "work" I have copied "junction.exe".
Finally in the same "work" I have a batch __init__.bat with content listed below.
Closed Android Studio and deleted original ".android", ".AndroidStudio2.2" and ".gradle" folders (from C:\Users\<YourProfile>).
Run __init__.bat (as Administrator to set also the JAVA_PATH via setx) to create the new junctions then restart Android Studio. This solution works also after I reimage Windows, just have to remeber to run first the mentioned bat...
PS: When I update java or upgrade Android I have to remeber to tweak the bat with the new revision numbers
Content of __init__.bat:
#echo off
#SET mySrcPath=%cd%
#rem echo "%myPath%"
#rem JAVA_HOME = D:\work\Android\Java\jdk1.8.0_77_x64\
#SET myJavaTarget=Java\jdk1.8.0_77_x64\
#SET myJavaPath=%mySrcPath%\%myJavaTarget%
#if not exist "%myJavaPath%" (
#echo CANNOT FIND myJavaPath = "%myJavaPath%"
#goto _exit_
)
#rem echo myJavaPath = "%myJavaPath%"
#setx JAVA_HOME %myJavaPath%
#SET myTargetPath=%USERPROFILE%
#SET myCopy1=.android
#SET myCopy2=.AndroidStudio2.2
#SET myCopy3=.gradle
#SET mySource1="%mySrcPath%\%myCopy1%"
#SET mySource2="%mySrcPath%\%myCopy2%"
#SET mySource3="%mySrcPath%\%myCopy3%"
#SET myTarget1="%myTargetPath%\%myCopy1%"
#SET myTarget2="%myTargetPath%\%myCopy2%"
#SET myTarget3="%myTargetPath%\%myCopy3%"
#rem echo.
#if not exist %mySource1% (
#echo CANNOT FIND mySource1 = %mySource1%
#goto _exit_
)
#if not exist %mySource2% (
#echo CANNOT FIND mySource2 = %mySource2%
#goto _exit_
)
#if not exist %mySource3% (
#echo CANNOT FIND mySource3 = %mySource3%
#goto _exit_
)
#if not exist %myTarget1% (
#echo creating myTarget1 = %myTarget1% from mySource1 = %mySource1%
#junction.exe %myTarget1% %mySource1%
) else (
#echo myTarget1 = %myTarget1% ALREADY EXISTS !!!!!!
)
#if not exist %myTarget2% (
#echo creating myTarget2 = %myTarget2% from mySource2 = %mySource2%
#junction.exe %myTarget2% %mySource2%
) else (
#echo myTarget2 = %myTarget2% ALREADY EXISTS !!!!!!
)
#if not exist %myTarget3% (
#echo creating myTarget3 = %myTarget3% from mySource3 = %mySource3%
#junction.exe %myTarget3% %mySource3%
) else (
#echo myTarget3 = %myTarget3% ALREADY EXISTS !!!!!!
)
:_exit_
#echo exiting...
#pause
I am using https://www.youtube.com/watch?v=kjsC-lKUgM8 tutorial to try to debug a simple NDK app. I have done everything as it is in the video except:
I am on OS X 10.9.3 instead of Windows.
I don't use android:debuggable=true(cause eclipse considers it as error) in AndroidManifest.xml instead I have set the NDK path from Preferences->Android->NDK and in Project Properties -> C/C++ Build unchecked Use default build command and set there ndk-build NDK_DEBUG=1 APP_OPTIM=debug.
I don't use x86 emulator but Samsung Duos S device with Android 4.0.4
But the breakpoiin that is used in the video in not being hit in my case. I am trying to debug a simple NDK test project already the 4th day. Have investigated lots of material:
Android Native Development Kit Cookbook
Bunch of forums and tutorials
Videos
But can not hit a single damn breakpoint. Please help if you could do this ever.
The following is an excerpt from an tutorial I wrote for our internal Android development team. The bulk of which was derived from this blog: http://mhandroid.wordpress.com/
Important notes:
I use a Linux (Ubuntu 12.04) environment for my Android work.
I used the ADT Bundle for Linux, Build: v22.2.1-833290 (Eclipse IDE + Extras)
These steps are for debugging from a Java Activity into a JNI shared object.
I created test projects for this tutorial which won't be posted here, though references to those projects are present in the instructions that follow. You'll need an existing Android Application Project as well as a JNI shared object that is being called by your Java code.
Project Setup
Enable Debugging.
Open AndroidManifest.xml, select the Application tab, and set Debuggable=true. This will make the application debuggable even when it's running on a device that's running in user mode.
4. Build the Native Sources. From the Terminal, enter the project directory and enter:
ndk-build -B
You should see the following output:
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Compile++ thumb : DebuggingTestJNI <= com_sample_test_DebuggingTestActivity.cpp
StaticLibrary : libstdc++.a
SharedLibrary : libDebuggingTestJNI.so
Install : libDebuggingTestJNI.so => libs/armeabi/libDebuggingTestJNI.so
Clean the Project. In the Eclipse menu strip, select Project→Clean. It is good to perform this step anytime you change/build your native sources. This step ensures that Eclipse will rebuild your .apk.
Native Debug Setup
Create Java Debug Configuration. We need to create a debug configuration for stepping into Java source code.
In the Eclipse toolbar, you'll see a green bug. Click the little arrow next to the bug and select "Debug Configurations…".
Double-click "Android Application" in the tree structure on the left. This will create a template for a new Android Application Debug Configuration.
In the "Name:" field, name it "DebuggingTest Java Debug" to make sure you know this Configuration applies specifically to the DebuggingTest project, and targets your Java source.
Under "Project:", click the "Browse…" button and select DebuggingTest.
Click "Apply" to save your changes.
Click "Close".
In the Eclipse toolbar, click the little arrow next to the bug and select "Organize Favorites…".
Click "Add…"
Select "DebuggingTest Java Debug" and click "OK".
Your new debug configuration has now been created and added to your favorites. You can access your favorites by clicking the little arrow next to the bug in the toolbar. "DebuggingTest Java Debug" should be at the top of the list.
Run ndk-gdb.
In the Eclipse toolbar, click the little arrow next to the bug and select "DebuggingTest Java Debug". This will deploy and install the DebuggingTest.apk to your connected Android device and start the debugger.
Navigate to the DebuggingTest project directory in your Terminal and type the following:
ndk-gdb
If the command succeeds, you should see the following:
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-elf-linux".
(no debugging symbols found)
…
If you forgot to start debugging the application before this step, you get the following:
ERROR: Could not extract PID of application on device/emulator.
Are you sure the application is already started?
Consider using --start or --launch= if not.
If your Android.mk file is malformed or contains $(info) blocks, you get the following:
cp: target ./obj/local/armeabi/gdb.setup' is not a directory /home/Dev/NDK/ndk-gdb: 639: cannot create start DebuggingTest/jni/Android.mk end DebuggingTest/jni/Android.mk ./obj/local/armeabi/gdb.setup: Directory nonexistent /home/Dev/NDK/ndk-gdb: 640: cannot create start DebuggingTest/jni/Android.mk end DebuggingTest/jni/Android.mk ./obj/local/armeabi/gdb.setup: Directory nonexistent start: invalid option: -x Try start --help' for more information.
If ndk-gdb is already running, you get the following:
ERROR: Another debug session running, Use --force to kill it.
Resolve your ERRORs before continuing. ndk-gdb MUST run successfully.
Running ndk-gdb does not only ensure us that we are doing everything right so far, but also creates app_process, gdb.setup and libc.so files in the obj/local/armeabi/ sub-directory of our project. Those files will be needed in later steps.
Stop Debugging.
In your Terminal, type CTRL+Z to stop ndk-gdb.
In Eclipse, select Run → Terminate.
4. Create C/C++ Debug Configuration. We need to create a debug configuration for stepping into C/C++ source code.
In Eclipse, click the little arrow next to the bug and select "Debug Configurations…".
Double-click "C/C++ Application" in the tree structure on the left. This will create a template for a new C/C++ Application Debug Configuration.
In the "Name:" field, name it "DebuggingTest C and CPP Debug" to make sure you know this Configuration applies specifically to the DebuggingTest project, and targets your C/C++ source.
In the "Main" tab:
Click "Browse…" on the "C/C++ Application:" field.
Navigate to "/home/Test/testing/DebuggingTest/obj/local/armeabi/app_process" and click "OK".
Click "Browse…" on the "Project:" field.
Select "DebuggingTest" and click "OK".
Check the "Disable auto build" box.
At the bottom of the form, you'll see "Using GDB (DSF) … - Select other…". Press the "Select other…" button.
In the pop-up, check the "Use configuration specific settings" box.
Select "Standard Create Process Launcher" in the list and press "OK".
In the "Debugger" tab:
Click the combo-box on the "Debugger:" field and select "gdbserver".
Uncheck the "Stop on startup at:" box.
In the "Main" sub-tab:
Click "Browse…" on the "GDB debugger:" field.
Navigate to "/home/Dev/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb" and click "OK". This debugger is distributed with the Android NDK.
In the "GDB command file:" field, type "/home/Test/testing/DebuggingTest/obj/local/armeabi/gdb2.setup". The gdb2.setup file does not exist yet, but we'll create it shortly.
Check the "Use full file path to set breakpoints" box.
In the "Connection" sub-tab:
Set "Type:" to TCP
Set "Port number:" to 5039
Click "Apply" to save your changes.
Click "Close"
In the Eclipse toolbar, click the little arrow next to the bug and select "Organize Favorites…".
Click "Add…"
Select "DebuggingTest C and CPP Debug" and click "OK".
Your new debug configuration has now been created and added to your favorites. You can access your favorites by clicking the little arrow next to the bug in the toolbar. "DebuggingTest C and CPP Debug" should be at the top of the list.
Create gdb2.setup. Eclipse doesn't like the "target remote :5039" line in gdb setup file because it wants to enter this command internally (that is why you configured port 5039 in the previous step). Because the gdb.setup file is recreated by the NDK scripts, you have to copy it to the gdb2.setup and point Eclipse to the gdb2.setup file (which we did in the previous step).
In your File Explorer, navigate to "/home/Test/testing/DebuggingTest/obj/local/armeabi/".
Copy the "gdb.setup" file and then paste it into the same folder. The result should be a file named "gdb (copy).setup".
Rename "gdb (copy).setup" to "gdb2.setup".
Open gdb2.setup by double-clicking the file.
Replace "set solib-search-path ./obj/local/armeabi" with "set solib-search-path /home/Test/testing/DebuggingTest/obj/local/armeabi".
Replace "file ./obj/local/armeabi/app_process" with "file /home/Test/testing/DebuggingTest/obj/local/armeabi/app_process".
Remove the line that reads "target remote :5039".
Save and Close the file.
5. Create ndk-gdb-eclipse. One last Eclipse housekeeping item. Eclipse will run the gdb binary itself, so we have to remove the execution of gdb from ndk-gdb. We'll save the original content by doing another Copy-Paste-Rename.
In your File Explorer, navigate to "/home/Dev/NDK".
Copy the "ndk-gdb" file and then paste it into the same folder. The result should be a file named "ndk-gdb (copy)".
Rename "ndk-gdb (copy)" to "ndk-gdb-eclipse".
Open ndk-gdb-eclipse by doing a right-click → Open With Other Application …
Select Text Editor from the list of applications
In the file, locate the line that reads "$GDBCLIENT -x native_path $GDBSETUP" (probably at the very bottom) and comment it out by prefixing it with a "#" character.
Save and Close the file.
When Debugging native sources within the Eclipse IDE, we'll use ndk-gdb-eclipse instead of ndk-gdb.
Debugging/Stepping into Code
Step Into the Java Code!
Put a breakpoint in the DebuggingTestActivity.java file at line 20 (System.out.println("hello world!")).
Insert a breakpoint in your main Activity BEFORE any calls into native code are made. onCreate() is generally the best place for this.
Start the DebuggingTest application in Debug mode by clicking on the little arrow next to the bug and selecting "DebuggingTest Java Debug".
You'll see a pop-up on the screen labeled "Confirm Perspective Switch". Press "Yes" if you'd like it to switch to your Debug Perspective. I would recommend doing so.
At this point, you should have hit the breakpoint you set.
Warning: The breakpoint we just hit sits inside of the onCreate function. This function will be called AFTER all static loadLibrary calls have been made. Notice that outside of the onCreate function there is a System.loadLibrary("DebuggingTestJNI") inside of a static block. This loadLibrary call will execute before we enter our onCreate function, ensuring that our native symbols are loaded by the time we hit our initial breakpoint. It is imperative that we are stopped at a breakpoint before proceeding!
Step Into the C/C++ Code!
In your Terminal, navigate to the DebuggingTest directory and type the following command:
ndk-gdb-eclipse ← Remember that we created this file back in step 6
If successful, the command should complete without any response.
Go back to Eclipse and run your C/C++ debugger by clicking the little arrow next to the bug and selecting "DebuggingTest C and CPP Debug"
Note: When I do this, I see dozens of errors in my Eclipse console, but things still seem to be working…
Switch back to your Java Perspective.
Click the double arrows at the top right of right of your Eclipse window and select Java.
Open DebuggingTest/jni/com_sample_test_DebuggingTestActivity.cpp
Set a breakpoint in the first JNI function that will be called by your main Activity.
Click Run → Resume (F8)
You'll get the Perspective Switch message again, so feel free to switch back to the Debug Perspective.
You should have just hit the breakpoint we just set in the native code!
Congratulations!!!
At this point you should be able to take what you've learned and adapt it to existing projects you may have.
invalid command-line parameter: ..\Documents\android-sdk-windows\tools/emulator-arm.exe.
Any idea how can I solve that problem?
The only problem here is : you have to remove 1 extra space from the Eclipse path where you have declared your Android SDK from your local path.
This u can verify by following steps :
1. Eclipse->Windows->Preferences->Select Android option from left column.
2. See the path : in my case its : D:\Andriod SDK\android-sdk-windows
3. If u observe, there is a space in Android & SDK.
4. Close eclipse and go to the actual D location.
5. Change the name of the Android SDK folder to AndroidSDK. (Just remove the space in betn).
6. Restart the eclipse again and define the new path.
BINGO... Your emulator will run without any problem.
Thanks
Saurabh M. Chande