Plugin to Install an APK using Cordova?

I am developing a Cordova app, and I need it to install a downloaded APK (It can also install it from a URL). I Have tried several plugins and none of the worked. Here is the list of the plugins I have tried and why they have failed:

cordova plugin add cordova-plugin-apkinstaller

Failed because it only works for Android 7, and I need it to work with Android 6

cordova plugin add

Failed while running the project with cordova run android the error says error: diamond operator is not supported in -source 1.6 even though I'm using Java 8 on my machine

cordova plugin add

Failed to add because there is no package.json in the plugin, while searching for a solution, I found out I could downgrade to Cordova 7 and use the --nofetch parameter to add the plugin. It solved the problem of adding the plugin, but every plugin that I add using the --nofetch option causes the application to stop firing the deviceready event.

Any help on fixing these errors or pointing out to how can I install an APK using cordova will be very appreciated.