Error with NetBeans Android plugin - android

I am currently developing an Android app and i am using Netbeans 6.9.1 and nbandroid 1.0 beta. I have installed Android SDK and configured everything but when i create a simple project and try to build it gives an error
Creating output directories if needed...
Created dir: C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin
Created dir: C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\gen
Created dir: C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin\classes
Compiling aidl files into Java classes...
Compiling RenderScript files into Java classes and RenderScript bytecode...
Generating R.java / Manifest.java from the resources...
compile:
C:\Documents and Settings\KeSoLK\My Documents\Android\android-sdk-windows\tools\ant\main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 2 source files to C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin\classes
Converting compiled files and external libraries into C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin\classes.dex...
=C:\Documents was unexpected at this time.
C:\Documents and Settings\KeSoLK\My Documents\Android\android-sdk-windows\tools\ant\main_rules.xml:472: The following error occurred while executing this line:
C:\Documents and Settings\KeSoLK\My Documents\Android\android-sdk-windows\tools\ant\main_rules.xml:203: apply returned: 255
BUILD FAILED (total time: 1 second)
what can be the problem? and how to solve it.
Thanks !!

Just encountered the same issue. It seems to be related to spaces in path at the time ant tries to start dex.bat with parameters:
<exec executable="${dx}" failonerror="true">
<arg value="--dex"/>
<arg value="--output=${basedir}/${intermediate.dex}"/>
<arg value="--positions=lines"/>
<arg path="${build.classes.dir}"/>
</exec>
The project won't run if ${basedir}, ${intermediate.dex} or ${build.classes.dir} contain spaces.
Parameters for batch files have to be encapsulated with "...". But how to do this when ant starts the batch file?
My quick workaround was to move the folder of my netbeans android project (not all projects) to a path that doesn't contain spaces.

Indeed it is a 'space in path' problem of Android SDK.
Other than that I'd strongly recommend you to update to newer version of both NetBeans and NBAndroid plugin.

Related

How to make a single module and resolve the dependency in android source code

I have an aosp code copy, and do a full build some days ago,
recently I sync the code to the latest, and try to modify some code in Contacts module, and try to build it with:
mmm packages/apps/Contacts
there is an error:
1 error during configuration. Try --help-properties for help.
Property 'jack.library.import' (in Options): element #1: The version of the library file 'out/target/common/obj/JAVA_LIBRARIES/android-support-test_intermediates/classes.jack' is not supported anymore. Library version: 3.4 - Current version: 3.5 - Minimum compatible version: 3.5
ninja: build stopped: subcommand failed.
build/core/ninja.mk:84: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
I search android-support-test in opengrok, and find android-support-test in prebuilts/misc/common/android-support-test
then I do:
mmm prebuilts/misc/common/android-support-test/
still error:
1 error during configuration. Try --help-properties for help.
Property 'jack.classpath': element #1: The version of the library file 'out/target/common/obj/JAVA_LIBRARIES/sdk_v23_intermediates/classes.jack' is not supported anymore. Library version: 3.4 - Current version: 3.5 - Minimum compatible version: 3.5
ninja: build stopped: subcommand failed.
build/core/ninja.mk:84: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
but I can't find sdk_23 module in opengrok.
then I delete
out/target/common/obj/JAVA_LIBRARIES/android-support-test_intermediates/classes.jack
and do
make android-support-test
It doesn't rebuild the module.
So, how can I solve the dependency when using "mmm" building a module?
Looks like Jack keeps on not liking your prebuilt material (/out dir), is it from an entire different Android version?
I would suggest to do make clean OR just delete all /out/ directory from root repo.
Then do mma Contacts from root repo directory.
For further info on mm, mmm, mma, etc. Check build/envsetup.sh:
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
lunch: lunch <product_name>-<build_variant>
tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5] [eng|userdebug|user]
croot: Changes directory to the top of the tree.
m: Makes from the top of the tree.
mm: Builds all of the modules in the current directory, but not their dependencies.
mmm: Builds all of the modules in the supplied directories, but not their dependencies.
To limit the modules being built use the syntax: mmm dir/:target1,target2.
mma: Builds all of the modules in the current directory, and their dependencies.
mmma: Builds all of the modules in the supplied directories, and their dependencies.
cgrep: Greps on all local C/C++ files.
jgrep: Greps on all local Java files.
resgrep: Greps on all local res/*.xml files.
godir: Go to the directory containing a file.

BUILD FAILED when building apk with crosswalk

I'm trying to build a web app with Crosswalk and I get an error while following the example tutorial from here : https://crosswalk-project.org/documentation/getting_started/run_on_android.html
Console :
>>python make_apk.py --package=org.crosswalkproject.example \ --manifest=xswag/manifest.json
Checking manifest file
Checking system requirements...ok
options.arch: x86
Starting application build (x86)
* Checking keystore for signing
No keystore provided for signing. Using xwalks keystore for debugging.
Please use a valid keystore when distributing to the app market.
* Updating project with xwalk_core_library
* Checking for external extensions
* Copying native libraries for x86
* Building Android apk package with Crosswalk embedded (x86)
BUILD FAILED
C:\Users\Jules\AppData\Local\Android\android-sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
C:\Users\Jules\AppData\Local\Android\android-sdk\tools\ant\build.xml:653: The following error occurred while executing this line:
C:\Users\Jules\AppData\Local\Android\android-sdk\tools\ant\build.xml:698: null returned: 1
Total time: 4 seconds
Command "C:\ant-1.9.4\bin\ant.bat release -f C:\Users\Jules\AppData\Local\Temp\Example-2kvo67im\build.xml -Dkey.store=C:\Users\Jules\Desktop\crosswalk-11.40.277
.7\xwalk-debug.keystore -Dkey.alias=xwalkdebugkey -Dkey.store.password=xwalkdebug -Dkey.alias.password=xwalkdebug" exited with non-zero exit code 1
build.xml lines 683 to 701 :
<echo level="info">----------</echo>
<echo level="info">Handling Resources...</echo>
<aapt executable="${aapt}"
command="package"
verbose="${verbose}"
manifest="${out.manifest.abs.file}"
originalManifestPackage="${project.app.package}"
androidjar="${project.target.android.jar}"
rfolder="${gen.absolute.dir}"
nonConstantId="${android.library}"
libraryResFolderPathRefid="project.library.res.folder.path"
libraryPackagesRefid="project.library.packages"
libraryRFileRefid="project.library.bin.r.file.path"
ignoreAssets="${aapt.ignore.assets}"
binFolder="${out.absolute.dir}"
proguardFile="${out.absolute.dir}/proguard.txt">
<res path="${out.res.absolute.dir}" />
<res path="${resource.absolute.dir}" />
</aapt>
Line 698 is proguardFile="${out.absolute.dir}/proguard.txt">
I have Python, ant, adb, Android JDK, Java and Oracle JDK installed and my Path variable is working.
I was getting similar errors when building apk using apache-ant (1.9.7).
I found that it needed java 8 version to convert it successfully (.class to .dex and then apk), initially I had java 7.
There needs to be some pre-requisite regarding versions of all the tools we use in this process i.e compliance of Android-NDK tools, Android-SDK tools, apache-ant an java (jdk/jre) versions in order to successfully get the apk. Since we do not get any relevant print/error message pointing to actual problem for such issues, we end up spending hard time to debug it. Thus make sure that you are all good with the versions of all tools in use.
I had the same issue, fixed it by installing lib32z1 lib32z1-dev
To see more verbose output try to use:
python make_apk.py --package=org.crosswalkproject.example \ --manifest=xswag/manifest.json --verbose

android ant uibuild.xml:198: null returned: 1

I am new to ant and Android uiautomator. When using ant to build my testing program I get:
-dex:
[dex] input: c:\Eclipse\workspace\Android\bin\classes
[dex] Converting compiled files and external libraries into c:\Eclipse\wor
kspace\Android\bin\classes.dex...
[dx] no classfiles specified
BUILD FAILED
C:\Android\sdk\tools\ant\uibuild.xml:198: null returned: 1
This is on the sample test code at: http://developer.android.com/tools/testing/testing_ui.html#sample
The full output from running the 'android create uitest...' and 'ant build' commands follows:
c:\Eclipse\workspace\Android>android create uitest-project -n AllAppsTest -t 7 -
p C:\Eclipse\workspace\Android\
Updated file C:\Eclipse\workspace\Android\build.xml
c:\Eclipse\workspace\Android>ant build
Buildfile: c:\Eclipse\workspace\Android\build.xml
-check-env:
[checkenv] Android SDK Tools Revision 23.0.2
[checkenv] Installed at C:\Android\sdk
-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for AllAppsTest...
[getuitarget] Project Target: Android 4.2.2
[getuitarget] API level: 17
[echo] ----------
[echo] Creating output directories if needed...
-pre-compile:
compile:
-post-compile:
-dex:
[dex] input: c:\Eclipse\workspace\Android\bin\classes
[dex] Converting compiled files and external libraries into c:\Eclipse\wor
kspace\Android\bin\classes.dex...
[dx] no classfiles specified
BUILD FAILED
C:\Android\sdk\tools\ant\uibuild.xml:198: null returned: 1
Total time: 0 seconds
My problem is similar to Android ant build project failure which didn't seem to have an answer (or at least one that I could descern from the responses.
I can't post an image (not enough mojo yet) but my test project is set up as:
AllAppsTest
src
com.uia.example.my
LaunchSettings.java
JRE System Library[JavaSE-1.6] (there are number of jar files here but I am not
listing them here)
Referenced Libraries
android.jar
uiautomator.jar
JUnit 4
I executed the following:
c:\Eclipse\workspace\Android>android create uitest-project -n AllAppsTest -t 7 -
p C:\Eclipse\workspace\Android\
Updated file C:\Eclipse\workspace\Android\build.xml
c:\Eclipse\workspace\Android>ant build
Buildfile: c:\Eclipse\workspace\Android\build.xml
Which resulted in the 'ant build' error output at the top of this post.
Any ideas?
Thanks
Eric
Not sure this is kosher answering my own question but...
I believe there is an error in the documentation (or the create step) for executing the build.xml file. The build.xml must be copied to the project directory, in my case AllAppsTest, and the 'ant build' command executed from there.
So the sequence of events to get this to work (in Windows command window):
Run the 'android create' command
c:\Eclipse\workspace\Android>android create uitest-project -n AllAppsTest -t 7 -
p C:\Eclipse\workspace\Android\
Switch to the AllAppsTest directory
cd AllAppsTest
Copy the build.xml file from the parent directory
copy ../build.xml
(which for some reason copies local.properties and project.properties also)
Run the 'ant build' command
When I first tried this the build failed as it didn't like the single and double quotes I had that were on comment lines. Not sure why that was but I removed them and the ant build worked OK.

how to generate apk using ant

i want to know how can we generate apk file using ant script. i came to know that we can use "ant debug" command to do that.but when i am running this command it is returning error that " Target "debug" does not exist in the project". i am using ant1.7.0.is it the issue?i have tried given below code to generate apk.
<target depends="build-subprojects,build-project" name="build">
<jar destfile="bin/test.apk" basedir="bin/classes" >
<manifest>
<attribute name="Main-Class" value="test.Main" />
</manifest>
</jar>
</target>
but the generated apk is different from auto generated apk while build the app using eclipse.Please guide me.
but when i am running this command it is returning error that " Target "debug" does not exist in the project"
Then you did not create your Android project properly, or you modified your build.xml file, or something else is broken.
As a test, I just ran the following command from my /tmp directory on Linux:
android create project --target android-17 --path Foo --package com.foo --activity Foo
I then changed into the Foo directory and ran ant debug. The app compiled, and in my bin/ directory is Foo-debug.apk.
If you are not getting this sort of result, delete your build.xml file and run android update project --path ..., where ... is the path to your project, to create a fresh build.xml file.

Android ==> ant and proguard?

I am getting the following error while obfuscating my application.
How can i define the output jar in my build.xml?
[java] Shrinking...
[java] java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
[java] at proguard.shrink.Shrinker.execute(Shrinker.java:148)
[java] at proguard.ProGuard.shrink(ProGuard.java:294)
[java] at proguard.ProGuard.execute(ProGuard.java:100)
[java] at proguard.ProGuard.main(ProGuard.java:499)
Use Android SDK Tools revision 8 or later
If you do not have build.xml for your project, run command like this in some empty directory
android create project --name <Your Project Name> --package <Your Company Name> --target 7 --path . --activity dummy Find build.xml which you can copy to root directory of the project.
In default.properties add reference to proguard settings (proguard.config=proguard.cfg)
Turn off android:debuggable in application manifest.
Run 'ant release' command
You should find directory called ./bin/proguard and ./bin/-release.apk. You can find more details here.
The tutorial here has never gone wrong for me.

Categories

Resources