6

I'm using Android Studio 1.0.1.

I managed to configure Android Library module in a project, so it's built into AAR.

My problem is that the AAR archive does not have my class inside. When I check MyProject/MyModule/build/intermediates/classes/debug/my/package/mymodule I can see my class compiled: MyClass.class

But when I enter to AAR (or unpack it), the very same directory (I mean the my/package/mymodule in classes.jar inside of the AAR file) contains only one file: BuildConfig.class

Why isn't my class included in the AAR?

4

2 回答 2

17

也许它与proguard配置有关我有同样的问题,我通过在proguard-rules文件中添加一条规则来解决它。这正是我所做的:

  • 添加规则-keep public class my.package.** { public *;}proguard-rules.pro 文件
  • gradlew assemble在终端上运行

之后,您将在youModule/build/outputs/aar/目录中找到您的 aar 文件

希望这有帮助

于 2015-02-11T16:15:12.130 回答
0

我在搞乱插件,在我的情况下(一个 Kotlin 库),我不小心删除了太多插件。如果您*.aar也是的,请确保您至少拥有这两组:

plugins {
    id("com.android.library")
    id("kotlin-android") // <-- this one was missing
}
于 2021-01-09T21:07:00.787 回答