问题
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