appceleratortitanium-modulestitanium-android

Titanium - Android module - Failed to compile Java Source files


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:


Solution

  • 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)