Do not use sun.* classes sun.* . For Base64 on Android, use a native class or add a library to your project that does this (total amount of Apache, etc.). Alternatively, just copy the Android source code into your project (in your own package) if you need to use it on devices up to 2.2.
source share