1

I am having an issue of Android module compilation.

I have created a module for some compression/decompression task and therefore I need to use Base64 Java class and hence adding the required package to import Base64.

import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
import com.sun.org.apache.xml.internal.security.utils.Base64;

If I remove these classes and comment their codes, then module builds successfully, and if I use these classes to support Base64 encoding/decoding then module is failed to build.

Does anyone know here the reason or solution?

Here are some last log lines from build_android.log file:

"/Users/jalvin/Documents/Appcelerator_Studio_Workspace/gziplibrary/android/build/classes" "-target" "1.6" "-g" "-source" "1.6" "@/Users/jalvin/Documents/Appcelerator_Studio_Workspace/gziplibrary/android/java-sources.txt" "-processor" "org.appcelerator.kroll.annotations.generator.KrollJSONGenerator" "-s" "/Users/jalvin/Documents/Appcelerator_Studio_Workspace/gziplibrary/android/build/generated/json" "-Akroll.jsonFile=gziplibrary.json" "-Akroll.jsonPackage=org.appcelerator.titanium.bindings" "-Akroll.checkTiContext=true" [ERROR] Failed to compile Java source files:

Prashant Saini
  • 3,539
  • 1
  • 10
  • 24

1 Answers1

1

com.sun.* classes are not part of the Java API, and you shouldn't be relying on them. I would suggest using Apache Commons Codec to do Base64 encoding instead.

(source: Package com.sun.org.apache.xml.internal.security.utils.Base64 does not exist)

Community
  • 1
  • 1
developer82
  • 13,237
  • 21
  • 88
  • 153
  • 1
    I could not find **org.apache** ones Base64 class, instead I used **import android.util.Base64;** class and its method **Base64.encodeToString(byte[], Base64.NO_WRAP);** – Prashant Saini Sep 22 '16 at 06:58