FreeBuilder in an Android Studio Java module

﹥>﹥吖頭↗ 提交于 2019-12-12 03:06:40

问题


I want to use FreeBuilder in a Java module in Android Studio. I added the following dependency in the module dependencies:

compile 'org.inferred:freebuilder:1.10.5'

Then I created the following class:

@FreeBuilder
public abstract class MyClass {

    public abstract String getValue1();

    public abstract String getValue2();

    public abstract String getValue3();

    public static class Builder extends MyClass_Builder {
    }
}

I can see that the MyClass_Builder class is correctly generated in the build/classes/main folder and the build is done successfully.

The problem is that the Android Studio does not find this class and therefore it marks it as an error.

How can I make Android Studio see the automatically generated class?

If I configure the module as an Android library module, the generated classes are detected by Android Studio.


回答1:


A workaround solution is to add the following line to the module build.gradle dependencies:

compile fileTree(include: ['*.jar'], dir: 'build/libs')

It is not a perfect solution, because a clean and build must be done every time a change is done on any class that uses the FreeBuilder.



来源:https://stackoverflow.com/questions/40107571/freebuilder-in-an-android-studio-java-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!