Aloha to all.
There is an MPXJ.org project on Java to import MS project files of all versions, but the trouble is that for .mpp files higher than version 2000-2003 .mpp, for files higher than 2003 awt java lib is used awt.Color (getColor) that is not imported on Android and everything falls with
NoClassDefFoundError: Failed resolution of: Ljava/awt/Color;
here the basic code
MPPReader reader = new MPPReader();
String path2file = context.getFilesDir() + "/" +SAMPLE21_MPPX;
ProjectFile projectFile = reader.read(path2file); //<-- falling here
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bio.tj, PID: 13427
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Color;
at net.sf.mpxj.mpp.MPPUtility.getColor(MPPUtility.java:543) etc...
and this MPXJ also depends on the Apache POI, which is normally not importing to Android, too, do not connect, I used this Assembly: https://github.com/centic9/poi-on-android
There is the solution for awt.Color, but here I don't understand what to do.
Here is step by step solution.
// after this 2 lines
compile 'org.apache.poi:poi-ooxml:3.17'
compile 'com.fasterxml:aalto-xml:1.0.0'
// add this line with mpxj gradle
compile group: 'net.sf.mpxj', name: 'mpxj', version: '7.2.1'
it is all in one apache poi and mpxj, after that I took this file and imported in my project, seems working fine for the first run (tested on ms project 2010/2016 file), and onCreate in my project I added
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.setProperty("org.apache.poi.javax.xml.stream.XMLInputFactory", "com.fasterxml.aalto.stax.InputFactoryImpl");
System.setProperty("org.apache.poi.javax.xml.stream.XMLOutputFactory", "com.fasterxml.aalto.stax.OutputFactoryImpl");
System.setProperty("org.apache.poi.javax.xml.stream.XMLEventFactory", "com.fasterxml.aalto.stax.EventFactoryImpl");