Android Studio Java模块中的FreeBuilder [英] FreeBuilder in an Android Studio Java module

查看:120
本文介绍了Android Studio Java模块中的FreeBuilder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Android Studio的Java模块中使用 FreeBuilder 。我在模块依赖项中添加了以下依赖项:

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 {
    }
}

我可以看到在build / classes / main文件夹中正确生成了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.

问题是Android Studio找不到此类,因此将其标记为错误。

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

如何让Android Studio看到自动生成的类?

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

如果我将该模块配置为Android库模块,则Android Studio将检测到生成的类。

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

推荐答案

一种解决方法是将以下行添加到模块build.gradle依赖项:

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

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

这不是一个完美的解决方案,因为每次使用FreeBuilder的任何类进行更改时都必须进行清理和构建。

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.

这篇关于Android Studio Java模块中的FreeBuilder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆