Compiling for Android SDK 1 (Part 1)

Part 1 Installing JDK1.5 and Eclipse Europa
Part 2 Generating R.java and compiling Java source
Part 3 Cross compile to JDK 1.5, convert to dex, package .apk
Part 4 Code sign .apk
Part 5 Troubleshooting and success

I've not managed to create a build of Phaedra that'll run on the Google G1/HTC Dream using modern tools, I've already removed modern Java language features from the source, and removed styles/themes and other attributes not available on older SDKs but the ouput .apk refuses to install, `adb install phaedra.apk` results in a unknbown error. Instead I'm going to try and build using the SDK available at the time.

After hunting around various old websites looking for the early SDKs I found Google actually have them all on a hidden away archive page:

SDK Archives

The html documentation in the SDK really recommend using the Eclipse plugin for Eclipse 3.3 (Europa), 3.4 (Ganymede), so I download that (for Linux) from:

Eclipse IDE Europa Winter Packages

That predictably fails on a modern Linux install running openjdk 11.0.11, I need JDK 5 or JDK 6. Oracle have the older JDKs available, though you do need to create an Oracle account to download:

Java Archive Downloads - Java SE 5

I download the rpm.bin Linux version and follow the Stack Overflow answer to install it:

how to install java 1.5 jdk in ubuntu 10.04?

 sudo su 
 chmod a+x jdk-1_5_0_22-linux-amd64-rpm.bin 
 ./jdk-1_5_0_22-linux-amd64-rpm.bin 
 apt install alien 
 alien jdk-1_5_0_22-linux-amd64.rpm 
 dpkg -i jdk_1.5.022-1_amd64.deb

I don't know where jdk_1.5 has been installed so I can't set it as the default, `sudo apt list --installed | grep -i jdk` gives:

jdk/now 1.5.022-1 amd64 [installed,local]
openjdk-11-jdk-headless/focal-updates,focal-security,now 11.0.11+9-0ubuntu2~20.04 amd64 [installed,automatic]
openjdk-11-jdk/focal-updates,focal-security,now 11.0.11+9-0ubuntu2~20.04 amd64 [installed]
openjdk-11-jre-headless/focal-updates,focal-security,now 11.0.11+9-0ubuntu2~20.04 amd64 [installed,automatic]
openjdk-11-jre/focal-updates,focal-security,now 11.0.11+9-0ubuntu2~20.04 amd64 [installed,automatic]

then `apt show jdk` gives me information about the install and `dpkg -L jdk` gives me the install location:

/usr/java/jdk1.5.0_22/

I edit `~/.bashrc` to point this directory as JAVA_HOME, save then type `source /etc/environment` to reload, and check the new value using `echo $JAVA_HOME`. I then find out Eclipse doesn't consult JAVA_HOME and I should add the path to `eclipse.ini`, but before -vmargs, my eclipse.ini now looks like:

-showsplash
org.eclipse.platform
-vm
/usr/java/jdk1.5.0_22/bin
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx256m

When I try and run ./eclipse I get an error, after a lot of searching I see a suggestion that it might be due to the manual Java install, after a lot of trial and error I navigate to `/usr/java/jdk1.5.0_22/jre/lib`, notice 'rt.pack' and run:

sudo unpack200 rt.pack rt.jar

After unpacking running this old version of Eclipse finally works.

Eclipse splash


© 2019 - 2021 ÖLAB
Part of a webring
view in Gemini