AndroidAnnotations:如何处理 "activity is not registered in the manifest"
AndroidAnnotations: how to handle "activity is not registered in the manifest"
当我在 IntelliJ IDEA (v2016.2.4) 中使用 @EActvity
时,代码检查会发出警告:例如
The '<activity> my.package.TestActivity' is not registered in the manifest
推荐的处理这种情况的方法是什么?
- IDEA中的Lint帮助提示我们应该
TestActivity
抽象。这听起来很合理,但是当我们这样做时,AndroidAnnotations 将不再生成 TestActivity_
class
- 另一种选择是将
@SuppressLint("Registered")
或@SuppressLint("all")
添加到TestActivity
class,但没有效果(警告仍然存在)
- 下一个选项是在
AndroidManifest.xml
中使用tools:ignore="all"
,但这也没有效果
您可以添加可以配置 LINT 抑制的 lint.xml 文件。您可以像这样抑制此错误:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="Registered" />
<ignore regexp=".*TestActivity.*" />
</issue>
</lint>
当我在 IntelliJ IDEA (v2016.2.4) 中使用 @EActvity
时,代码检查会发出警告:例如
The '<activity> my.package.TestActivity' is not registered in the manifest
推荐的处理这种情况的方法是什么?
- IDEA中的Lint帮助提示我们应该
TestActivity
抽象。这听起来很合理,但是当我们这样做时,AndroidAnnotations 将不再生成TestActivity_
class - 另一种选择是将
@SuppressLint("Registered")
或@SuppressLint("all")
添加到TestActivity
class,但没有效果(警告仍然存在) - 下一个选项是在
AndroidManifest.xml
中使用tools:ignore="all"
,但这也没有效果
您可以添加可以配置 LINT 抑制的 lint.xml 文件。您可以像这样抑制此错误:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="Registered" />
<ignore regexp=".*TestActivity.*" />
</issue>
</lint>