I have the following line of code in MainActivity.java:
Workbook myWorkBook = WorkbookFactory.create(new File("C://sampleWB.xlsx"));
which throws the following error: java.io.FileNotFoundException
I have also tried adding the excel file in the assets folder (app > src > main > assets), and tried the following code, but the same exception is being thrown.
Workbook myWorkBook = WorkbookFactory.create(new File("sampleWB.xlsx"));
I have added the following in AndroidManifest.xml, but it did not resolve anything either:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
if it's of any help, this is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.test.testProj"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation "org.apache.poi:poi:3.17"
implementation "org.apache.poi:poi-ooxml:3.17"
implementation 'com.fasterxml:aalto-xml:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}