Exception – BootstrapMethodError: while parsing CSV using OpenCSV in Android App
java.lang.BootstrapMethodError: Exception from call site #30 bootstrap method
at org.apache.commons.lang3.Validate.notNull(Validate.java:225)
at org.apache.commons.lang3.reflect.FieldUtils.getAllFieldsList(FieldUtils.java:217)
at org.apache.commons.lang3.reflect.FieldUtils.getAllFields(FieldUtils.java:202)
at com.opencsv.bean.util.OpencsvUtils.determineMappingStrategy(OpencsvUtils.java:66)
at com.opencsv.bean.CsvToBeanBuilder.build(CsvToBeanBuilder.java:210)
at com.example.rkmmedialibrary.MainActivity.importCsv(MainActivity.java:95)
at com.example.rkmmedialibrary.MainActivity.onActivityResult(MainActivity.java:80)
at android.app.Activity.dispatchActivityResult(Activity.java:7454)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassCastException: Bootstrap method returned null
Solution: for BootstrapMethodError
The issue is probably due to Java Version Mismatch, Kindly add below code in your build.gradle file
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Reference: SO Post