Right now this is not possible. D8 will only allow compiling code which use invoke-custom and method handles for a minSdkVersion
of 26 or higher, as that is the first version where these features are supported by Android.
There is an open issue on lifting that restriction. However, depending on the code in the library this might just end up as a runtime error if the code using invoke-custom and method handles will be hit at runtime on a device with API level of 25 or below.
The reason you can run you code from Android Studio, is that when debugging on a device or emulator, Android Studio will "artificially" raise the minSdkVersion
for the build to that of the device or emulator attached. This is to provide the best development experience by taking advantage of what the device or emulator supports.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…