Unfortunately it looks like the latest Eclipse 4.17 requires Java 11 and so Android application using Andmore ADT cannot be build. Simply switching the vm to old java isn't an option as Eclipse simply won't work.
Building an android application seems to brake around the signing part of the package with the error:
Errors occurred during the build.
Errors running builder 'Android Package Builder' on project 'com.pijulius.tvguide'. sun/misc/BASE64Encoder
After some digging found out that this file (have no idea where it comes from but gets automatically created whenever you delete it so I imagine one of the plugins provides it but not sure which one or how):
/opt/eclipse/configuration/org.eclipse.osgi/126/0/.cp/libs/sdklib.jar
is the file that contains the SignedJarBuilder.java
class and causes the
sun/misc/BASE64Encoder error.
Tried to look around for fixed version of this class but unfortunately Google dropped the tools all together instead of the command tools they use now and that's a total rewrite as far as I could see so using that wasn't an option.
Then found an old version of this tools build here:
https://mvnrepository.com/artifact/com.android.tools/sdklib/22.1.3
which uses BouncyCastle instead of sun's base64 implementation, you can see the source code here:
https://android.googlesource.com/platform/tools/build/+/e7556cf19d05123e3d8abdc56b718090d600fce3/builder/src/main/java/com/android/builder/signing/SignedJarBuilder.java
Now what I did is:
Step 1: simply replace this SignedJarBuilder class with the one from the old tools sdklib build (22.1.3) as follows:
com/android/sdklib/internal/build/SignedJarBuilder.class com/android/sdklib/internal/build/SignedJarBuilder$CountOutputStream.class
Step 2: also added the class files for BouncyCastle builds from these two files:
bcpkix-jdk15on-166.jar bcprov-ext-jdk15on-166.jar
They both were download from here:
https://www.bouncycastle.org/latest_releases.html
Finally: rebuild the sdklib.jar zip file and replaced the original one with the new one and finally it's working. Building and installing works too and should work with both new and old java too as far as I can tell.
The final sdklib.jar file (that I use, including the other jar files) can be found here:
http://pijulius.com/julius/eclipse/
ps: why not use Android Studio? well because I want to use one IDE for different projects instead of always switching app just to work on different things, that's the whole idea behind Eclipse and really hope android development possibility won't die on it's end.
Comments (4)
I Used Windows 10 and Eclipse 2020-12, (for me) the
sdklib.jar
wasnt in126
but inso the path seems to be a bit "random".
Also I couldn't use you're provided
sdklib.jar
file I had to "build" my own with you're provided Resources. But after that it works like a charm.Thank you!