I am using this library for fast reading xlsx file kept in asset folder android as it was suggested in this answer
while running the app i am getting following error
W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.djsde.splashactivity, PID: 31903
java.lang.NoClassDefFoundError: Failed resolution of: [Ljava/nio/file/attribute/FileAttribute;
at com.monitorjbl.xlsx.impl.TempFileUtil.writeInputStreamToFile(TempFileUtil.java:11)
at com.monitorjbl.xlsx.impl.StreamingWorkbookReader.init(StreamingWorkbookReader.java:88)
at com.monitorjbl.xlsx.StreamingReader$Builder.open(StreamingReader.java:251)
at com.example.djsde.splashactivity.Puzzle.<init>(Puzzle.java:99)
at com.example.djsde.splashactivity.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:6275)
at ...
on clicking Puzzle.java:99 it takes me to following part of code
InputStream myInput;
try {
AssetFileDescriptor fileDescriptor = assetManager.openFd(xlname);
myInput = fileDescriptor.createInputStream();
Workbook workbook = StreamingReader.builder()
.rowCacheSize(100)
.bufferSize(4096)
.open(myInput); //this line
...
my gradle app file i have altered following
apply plugin: 'com.android.application'
android {
...
aaptOptions {
noCompress "xlsx"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/INDEX.LIST'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.monitorjbl:xlsx-streamer:2.1.0'
api group: 'com.fasterxml', name: 'aalto-xml', version: '1.0.0'
}
adding
implementation 'com.android.support:multidex:1.0.3'
And set multiDexEnabled true
inside defaultConfig to turn multidexing on. didn't work