是否可以在运行时动态包含依赖项?

时间:2020-07-22 16:50:24

标签: android gradle

我有一个独特的应用程序,需要为不同的Android平台(智能手机/平板电脑和刷卡机)构建。在其中一台卡片机中,在NDK之上建立了.aar依赖关系,其更改超出了我的能力范围。当我将此依赖项导入gradle并将apk安装在不是使用此类.aar功能的特定设备上时,该应用程序将崩溃。

dependencies {

...

    // Pax
    implementation files('libs/NeptuneLiteApi_V2.04.00_20180329.jar')
    implementation files('libs/PPCompAndroid-v1.32.aar') //This dependency is what makes the app crash =/

    // NewLand
    implementation files('libs/libposdigital-1.5.1-4-release.aar')

    // Zoop
    implementation files('libs/zoop-emv-connect-pax-a920-pos_0.10.jar')

...

}

我可以在运行时代码中使用“ Build.MODEL”来识别设备,并为每种类型的设备使用正确的SDK。

我的问题是:我可以在异常时间内在代码中包括此依赖项.aar,而不是像传统上那样将其包括在gradle中吗?

0 个答案:

没有答案