remobjects / ElementsSamples

The official sample suite for RemObjects Elements (Oxygene, C# and Swift)
MIT License
21 stars 8 forks source link

apkbuilder: Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder #6

Open Brennan-W opened 5 years ago

Brennan-W commented 5 years ago

Installed Fire, installed Android Studio, cloned this git repository, installed JDK 11 (latest version). When building org.me.firstandroidapp.sln, I get this error:


RemObjects EBuild. An open source build engine for Elements and beyond.
Copyright RemObjects Software 2016-2018. All Rights Reserved. Created by marc hoffman.
Version 10.0.0.2343 (develop) built on bajor, 20181108-182936. Commit f102cb8.

   Android SDK found in '/Users/me/Library/Android/sdk'.
   Android Build Tools found in '/Users/me/Library/Android/sdk/build-tools/28.0.3'.
   Android ApkBuilder found in '/Users/me/Library/Android/sdk/tools/lib/sdklib-26.0.0-dev.jar:/Users/me/Library/Android/sdk/tools/lib/sdk-common-26.0.0-dev.jar:/Users/me/Library/Android/sdk/tools/lib/common-26.0.0-dev.jar'.
   No exact platform version was specified for target 'Cooper-Android', using android-28.
   Reference 'android' was resolved to '/Users/me/Library/Android/sdk/platforms/android-28/android.jar' for target 'Cooper-Android'.
   Reference 'cooper' was resolved to '/Applications/Fire.app/Contents/Resources/Reference Paths with Data Abstract Trial/Cooper/../../References/Cooper/cooper.jar' via XML for target 'Cooper-Android'.
   Reference 'swift' was resolved to '/Applications/Fire.app/Contents/Resources/Reference Paths with Data Abstract Trial/Cooper/../../References/Cooper/swift.jar' via XML for target 'Cooper-Android'.
   Found Android Manifest: '/Users/me/Dropbox/Developer/Fire Tests/ElementsSamples/Silver/Cooper/Android/FirstAndroidApp/Properties/AndroidManifest.android-xml'.
   Android build version is '28'.
   Android manifest file is '/Users/me/Dropbox/Developer/Fire Tests/ElementsSamples/Silver/Cooper/Android/FirstAndroidApp/Properties/AndroidManifest.android-xml'.
   RemObjects Elements (Oxygene, C#, Swift and Java) Compiler for .NET, Cocoa, Java and Island.
   Version 10.0.0.2343 (develop) built on bajor, 20181108-182936. Commit f102cb8.
   Copyright 2003-2018 RemObjects Software, LLC. All rights reserved.

   Source file: /Users/me/Dropbox/Developer/Fire Tests/ElementsSamples/Silver/Cooper/Android/FirstAndroidApp/DisplayMessageActivity.swift
   Source file: /Users/me/Dropbox/Developer/Fire Tests/ElementsSamples/Silver/Cooper/Android/FirstAndroidApp/MainActivity.swift
   Source file: /Users/me/Library/Application Support/RemObjects Software/EBuild/Obj/org.me.firstandroidapp-A437BB9E93FD275FC94A1BB7900DC58AFF0B1C51/Debug/Cooper-Android/r/R.java
   Reference: /Applications/Fire.app/Contents/Resources/Reference Paths with Data Abstract Trial/Cooper/../../References/Cooper/cooper.jar
   Reference: /Applications/Fire.app/Contents/Resources/Reference Paths with Data Abstract Trial/Cooper/../../References/Cooper/swift.jar
   Reference: /Users/me/Library/Android/sdk/platforms/android-28/android.jar
E: apkbuilder: Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
E: The error(s) above might be due to the Android tool chain not supporting JDK9 yet. Downgrade to JDK8 to fix.
   Project 'org.me.firstandroidapp' failed to build.
   Solution 'org.me.firstandroidapp' failed to build all projects.```

I've developed iOS apps in Xcode using Swift, but I've never used Fire or anything related to Android.
Brennan-W commented 5 years ago

Installed jdk1.8.0_191.jdk and move JDK 11 of of the same directory. The build worked after doing so

artob commented 5 years ago

I ran into the same problem with the current latest everything installed (JDK 12, Android Studio 3.3.2, Fire 10.0.0.2389).

Since Oracle JDK 8 has been end-of-lifed, the simplest and most sustainable solution going forward is to disable any installed modern JDKs and install Amazon Corretto 8.

More ideally, though, there ought to be a way to set the JAVA_HOME environment variable when Fire/Ebuild invokes apkbuilder, so as to configure the correct JDK used just for builds with Fire, without affecting the rest of the system.