问题描述
的从ADT网站:的
常量不是最终的库项目。这样做的原因
很简单:当多个库项目相结合,实际
田野(必须是唯一的)的价值可能会发生冲突。 ADT之前
14,所有的领域是决赛,所以作为结果,所有的图书馆都必须有
他们所有的资源和相关的Java code编译随着
每当他们被用于主体工程。这是不好的表现,
因为它使建立非常缓慢。它还prevented分发库
这不包括源$ C $ C项目,限制了使用范围
库项目。
这是解释。
所以,为了解决这个问题,我用 -
So, in order to fix this, I used -
int id = view.getId();
if (id == R.id.button1) {
action1();
} else if (id == R.id.button2) {
action2();
} else if (id == R.id.button3) {
action3();
}
而不是 -
int id = view.getId();
switch (id) {
case R.id.button1:
action1();
break;
case R.id.button2:
action2();
break;
case R.id.button3:
action3();
break;
}
不过,我有一个类全球国际
,我不能够解决这些错误的一样。
But I have a class GlobalData
and I am not able to fix these errors for the same.
code -
错误说 -
有关注释属性的值 ReportsCrashes.resDialogText
必须是一个常量前pression当我将光标指向错误在 R.string .crash_dialog_text
。
The value for annotation attribute ReportsCrashes.resDialogText
must be a constant expression when I point the cursor to error at R.string.crash_dialog_text
.
推荐答案
您必须动态地添加这些参数的onCreate()
应用程序类如下 -
You have to add those parameters dynamically onCreate()
in the application class as follows-
public class GlobalData extends Application {
@Override
public void onCreate() {
ACRAConfiguration config = ACRA.getConfig();
config.setMailTo("abc@test.com");
config.setResDialogIcon(android.R.drawable.ic_dialog_info);
config.setResDialogText(R.string.crash_dialog_text);
config.setResDialogTitle(R.string.crash_dialog_title);
config.setResDialogCommentPrompt(R.string.crash_dialog_comment_prompt);
config.setResDialogOkToast(R.string.crash_dialog_ok_toast);
try
{
config.setMode(ReportingInteractionMode.DIALOG);
}
catch (ACRAConfigurationException e)
{
e.printStackTrace();
return;
}
ACRA.setConfig(config);
ACRA.init(this);
super.onCreate();
}
}
这篇关于Android的库项目无法ACRA使用,由于其资源标识符不是最终场了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!