帖子
帖子
用户
博客
课程
显示全部楼层
14
帖子
0
勋章
81
Y币

[插件开发] 插件开发 aar集成编译问题

[复制链接]
发表于 2023-12-28 14:53:25
Android studio上开发插件CanUtil,    插件中集成了一个三方的mcCan.aar ,   本地功能调试完成后 , 最后在 Build ->Make Module  步骤 编译报异常:

Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :CanUtil project caused this error: F:\ApiCloud\PluginsDevProject_Android_1.1.52\PluginsDevProject_Android_1.1.52\androidstudio\AndroidPluginDevSDK_androidStudio\CanUtil\libs\mcCan.aar

下面是CanUtil 的build.gradle 中的 dependencies 配置:

dependencies {
    compileOnly fileTree(dir: "libs", include: ["*.jar"])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation files('libs/mcCan.aar')
    compileOnly files('../app/libs/apiEngine v3.0.0.jar')
}
请教下改怎么在插件中集成aar 才能正常的Make Module 非常感谢!!!!!
130
帖子
7
勋章
5万+
Y币
没有遇见你这种情况
130
帖子
7
勋章
5万+
Y币
给你百度了一下,做参考


把引用的implementation改为provided即可
dependencies {
    implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
    compileOnly files('../app/libs/apiEngine v3.0.0.jar')
    implementation 'com.android.support:support-v4:26.0.0'

}

我都是这么写的 别的不要加  少了什么就要放到你插件lib目录下即可
您需要登录后才可以回帖 登录

本版积分规则