I'm trying to use two modified Apache POI libraries. Each libray has modifications to work properly on android 4.+ and 5.+.
I need to import specific class of specific library depending on android version.
For example:
Android 4.+ versions:
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
of compile files('libs/aa-poi-3.10-min-0.1.5.jar')
Android 5.+ versions:
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
of compile files('libs/poi-3.12-android-a.jar')
How could i do this? Thanks
Define two flavours
productFlavors {
android4plus {
minSdkVersion 14
}
android5plus {
minSdkVersion 21
}
}
Now you can setup different dependencies per flavour
android4plusCompile files('libs/aa-poi-3.10-min-0.1.5.jar')
android5plusCompile files('libs/poi-3.12-android-a.jar')
As result, you can switch between flavours during development and will have two APK files to distribute.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.