Building Android apk with linux-sun-jdk fails under FreeBSD

Hi,
This is my first attempt to develop Android app under FreeBSD. With the help of this blog, I download Android SDK (with ADT bundled), enable Linux compat layer, install java/linux-sun-jdk17 and devel/apache-ant. I create my "Hello World" Android project in ADT and try to build it with ant in command line terminal. The process of building apk using " ant debug" works flawlessly with ant+OpenJDK 7:
Code:
justin@darkgeek.pts/0 ~/workspace/Dudu % ant debug
Buildfile: /usr/home/justin/workspace/Dudu/build.xml

-set-mode-check:

-set-debug-files:
...(skip)
-post-package:

-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: /usr/home/justin/workspace/Dudu/bin/FullscreenActivity-debug.apk
[propertyfile] Creating new property file: /usr/home/justin/workspace/Dudu/bin/build.prop
[propertyfile] Updating property file: /usr/home/justin/workspace/Dudu/bin/build.prop
[propertyfile] Updating property file: /usr/home/justin/workspace/Dudu/bin/build.prop
[propertyfile] Updating property file: /usr/home/justin/workspace/Dudu/bin/build.prop

-post-build:

debug:

BUILD SUCCESSFUL
Total time: 18 seconds
However, if I force ant to use linux-sun-jdk instead of OpenJDK to build apk, the building fails:

Code:
justin@darkgeek.pts/0 ~/workspace/Dudu % setenv JAVACMD /usr/local/linux-sun-jdk1.7.0/bin/java
justin@darkgeek.pts/0 ~/workspace/Dudu % setenv PATH /usr/local/linux-sun-jdk1.7.0/bin:$PATH
justin@darkgeek.pts/0 ~/workspace/Dudu % ant debug
Buildfile: /usr/home/justin/workspace/Dudu/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 22.3.0
 [checkenv] Installed at /home/justin/adt-bundle-linux-x86-20131030/sdk

...(skip)

BUILD FAILED
/home/justin/adt-bundle-linux-x86-20131030/sdk/tools/ant/build.xml:962: The following error occurred while executing this line:
/home/justin/adt-bundle-linux-x86-20131030/sdk/tools/ant/build.xml:973: The following error occurred while executing this line:
/home/justin/adt-bundle-linux-x86-20131030/sdk/tools/ant/build.xml:313: com.android.sdklib.build.ApkCreationException: java.io.FileNotFoundException: /usr/home/justin/workspace/Dudu/bin/classes.dex does not exist
	at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:469)
	at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:394)
	at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:334)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.Main.runBuild(Main.java:851)
	at org.apache.tools.ant.Main.startAnt(Main.java:235)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.FileNotFoundException: /usr/home/justin/workspace/Dudu/bin/classes.dex does not exist
	at com.android.sdklib.build.ApkBuilder.checkInputFile(ApkBuilder.java:938)
	at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:440)
	... 62 more

Total time: 2 seconds
I use FreeBSD 10 amd64 on my personal computer, and have linprocfs entry in /etc/fstab:
Code:
justin@darkgeek.pts/0 ~/workspace/Dudu % cat /etc/fstab 
# Device	Mountpoint	FStype	Options	Dump	Pass#
/dev/ada0p2	/		ufs	rw	1	1
/dev/ada0p3	none		swap	sw	0	0
linprocfs   /compat/linux/proc   linprocfs   rw   0  0
Maybe the java/linux-sun-jdk17 is unstable on FreeBSD amd64? :q
 
Re: Building Android apk with linux-sun-jdk fails under Free

I've never done much Java but it looks like it's missing a file:
Code:
FileNotFoundException: /usr/home/justin/workspace/Dudu/bin/classes.dex does not exist
That seems to be the cause of the error. I don't know why there's a difference between OpenJDK and the Linux JDK though.
 
Re: Building Android apk with linux-sun-jdk fails under Free

SirDice said:
I've never done much Java but it looks like it's missing a file:
Code:
FileNotFoundException: /usr/home/justin/workspace/Dudu/bin/classes.dex does not exist
That seems to be the cause of the error. I don't know why there's a difference between OpenJDK and the Linux JDK though.
Well, I read this error message too and that file isn't there indeed. However, I just find that if I run " ant debug" again (with linux-sun-jdk), it remains complaning that "FileNotFoundException", and then I run " ant debug" the third time, it builds my apk successfully! Very strange. :O
To confirm it, now I create a new Android project in ADT and try to build it with ant. I simply need to type command " ant debug" once to build an apk using OpenJDK successfully, while have to type "ant debug" multiple times (each time gives some errors except the last one) to build it with linux-sun-jdk.
I think I can stick to OpenJDK for Android development, but still are willing to find what's wrong with linux-sun-jdk. Thank you. :)
 
Back
Top