how to debug this android program - android

when i am trying to run a simple android application in netbeans 6.9.1 i am getting the below error:
**Creating output directories if needed...
Generating R.java / Manifest.java from the resources...
Compiling aidl files into Java classes...
compile:
C:\Program Files\Android\android-sdk-windows\tools\ant\main_rules.xml:361: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 1 source file to C:\Documents and Settings\JiggleVostro1310\My Documents\NetBeansProjects\FTPClient\bin\classes
Converting compiled files and external libraries into C:\Documents and Settings\JiggleVostro1310\My Documents\NetBeansProjects\FTPClient\bin\classes.dex...
=C:\Documents was unexpected at this time.
C:\Program Files\Android\android-sdk-windows\tools\ant\main_rules.xml:449: The following error occurred while executing this line:
C:\Program Files\Android\android-sdk-windows\tools\ant\main_rules.xml:199: apply returned: 255
BUILD FAILED (total time: 1 second)**
Can anyone explain me what this means and how to resolve this. I am new to android applications

I suspect that there's a bug in the Ant scripts somewhere and something isn't properly handling path names that contain spaces. Try moving your project to a directory outside My Documents, to somewhere like C:\AndroidProjects\FTPClient.

=C:\Documents makes me think you have a bad setting somewhere. One of two things is likely happening:
That equals sign before the path is causing the failure.
A path is specified somewhere which requires being wrapped in quotes but isn't, because of the space in the path (ex: should be "C:\Documents And Settings...")
I would check your build properties and paths, as well as any included JAR files or Library projects for a small typo.

Related

I'm trying to compile a simple HelloJNI program using ndk in Android Studio and get an error [duplicate]

I just added a few new statements to my 'android.mk' project file to compile new source code files and I'm having the error after compiling all the *.cpp files:
arm-linux-androideabi-g++.exe: CreateProcess: No such file or directory
make: *** [/cygdrive/...] Error 1
Do anyone else has had a similar error ? I can't figure out why this happens, I didn't modified paths, just added source code files.
Thanks in advance.
It could be that the command line is too long for cygwin (see here: How to build OpenSSL on Android/Linux ?)
Try moving everything to somewhere with a shorter path. I just had the error after adding a couple of files to the android.mk file, and temporarily moving the android project to somewhere like /cygdrive/c/projects allowed it to build. I just built it there then moved everything back afterwards.
The maximum length of the command line string passed to CreateProcess() is 32,768 characters. The length includes all the arguments.
Incidentally, the Android NDK build system may generate a command line longer than 32,768 characters because the full paths of your source files are too long and the number of source files is too large and the object file paths are thus too long and many. All the full paths are added to the command line when linking.
I solved this problem by placing the project folder at the root of the Windows file system and renaming it to one letter like "C:\E" so that all the paths got shorter than before.
This issue is probably caused by the insuffient memory on the build PC.
I've ran recently into the same issue on virtual Windows XP SP3 32-bit - during the linking phase the system tried to consume up to 2.6 GB of memory, while the limit was set at 2.2 GB, and there was not enough free space on the disk to allocate the needed swap file...
I had the same error like you. Use a new system (Windows on a VM etc.), try again.
It is likely to be caused by other software conflict, maybe too many tools on your OS.

error: jni.h: No such file or directory

I am getting error while trying to build android ndk project:
error: jni.h: No such file or directory
But: locate jni.h command show me:
locate jni.h
/usr/lib/jvm/java-6-openjdk-i386/include/jni.h
What is wrong in my actions?
EDIT:
If I hardcode it in the source code it work but I have a lot of files that are using this header. What I need to do that all my files can see /usr/lib/jvm/java-6-openjdk-i386/include/jni.h
?
Try setting the installation location of your NDK in PATH in your rc file, let's say ~/.bashrc:
NDK=/path/to/your/ndk/location
export PATH=$PATH:$NDK
Source the rc file by running source ~/.bashrc.
Now when you run ndk-build, it will setup the whole build environment for you by running make command against a bunch of make files under $NDK/build/core, it will setup correct header file search path for your project depending on the android:targetSdkVersion setting in AndroidManifest.xml.
The jni.h needed by your NDK project is located under $NDK/platforms/android-14/arch-arm/usr/include.
Android NDK projects will not use any JNI header files under your JDK installation, files under /usr/lib/jvm/.... will never be touched.

Build android application for release using ant in eclipse

When signing and building my application for release through ant in eclipse I am getting an error.
I am using the ant task that comes with the android sdk.
Keystore file, alias, pass are defined in ant.properties.
BUILD FAILED
C:\Program Files
(x86)\Android\android-sdk-windows\tools\ant\build.xml:981: The
following error occurred while executing this line:
C:\Program Files
(x86)\Android\android-sdk-windows\tools\ant\build.xml:995: Execute
failed: java.io.IOException: Cannot run program "jarsigner.exe" (in
directory "C:\dev\projects\sample1"): CreateProcess error=2, The
system cannot find the file specified
Followed instructions here: http://developer.android.com/guide/developing/building/building-cmdline.html
You need to have the folder YOUR_JDK\bin in your path
(YOUR_JDK being the folder where you have installed the Java JDK)
It's looking for the Jar signer in the wrong location.
Might be worth checking your path environment variable is set up correctly (so that it can find jarsigner.exe)

Managing android projects from command line

I am managing and running my android app from command line without using ant, I followed these steps:
generate R.java
compile R.java and all .java files in src to .class files
assembling set of class files into dex file using the command below
dx --dex --verbose --output=./bin/classes.dex ./bin
.class files are in bin directory.
But I'm getting the following errors in these steps:
java.lang.Runtime exception:.\bin file not found
at com.android.dx.cf.direct.ClassPathOpener.process
at com.android.dx.command.dexer.Main.processOne
at com.android.dx.command.dexer.Main.processAllFiles
at com.android.dx.command.dexer.Main..run
at com.android.dx.command.dexer.Main.main
at com.android.dx.command.Main.main
Due to this, I'm unable to create the Classes.dex file.
Can someone suggest a solution for this?
[not using eclipse and ant only through command line]
If you need to "manage your Android projects from command line", when you should use Ant build.
Ant's build.xml is a official standardized way to build Android projects. Ant scripts can do anything you may need to build your project.
If you want most modern build tools for Android, you can look at Gradle for Android projects. Note: today it's still in alpha stage.
Try entering the full path instead of the relative path.
Also you must put the class files inside a directory named exactly like it's package name. for example for com.test.me.MyActivity you must use com/test/me/MyActivity.class
And since we are on the topic, remember that dx can only work with class files created using Java6 (or less) so if you are using java7 to compile your code, add "source 1.6 target 1.6" parameters to your command line.

Dex not working with spaces in path on the new android platform tools (V8)

On the new android platform tools (v8) released with the 2.3 SDK, I get an error while running dex from the ant script
I typed the usual "ant release", and got an error in the dex stage
-dex:
[echo] Converting compiled files and external libraries into C:\Documents and Settings\omri\My Documents\myapp\bin\classes.dex...
[apply] =C:\Documents was unexpected at this time.
My guess is that it has something to do with the spaces in the path.
anyone know what the issue is and how to fix it?
I have the same problem it appears to be with the spaces in the path as you guessed.
If you specify the path using 8.3 names there will be no spaces and dex will work.
For the path above the 8.3 path would be similar to below:
C:\Docume~1\omri\MyDocu~1\myapp\bin
You can use dir /X to find the 8.3 name of a file or folder.
This is an interesting problem, there is another way of dealing with this - in fact, the batch file for dex is at fault! I discovered the fix for it in a blog here.
Basically look for the lines within the dex.bat around line 49 or thereabouts
REM capture all arguments to process them below
set params=%*
:nextArg
if "%params%"=="" goto endArgs
Insert this sequence of code in between
REM capture all arguments to process them below
set params=%*
echo ***** SKIP check the parameter *****
set args=%params%
goto endArgs
:nextArg
if "%params%"=="" goto endArgs
After that, you should save and rebuild with ANT, now it should work, it works around the fact that the command does not parse duplicated double-quotes.

Categories

Resources