从GIT闹钟 - 给出错误 - Android电子 [英] Alarm Clock from GIT - Gives error - Android

查看:171
本文介绍了从GIT闹钟 - 给出错误 - Android电子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载从以下链接闹钟例如:

I downloaded the alarm clock example from the below link:

https://github.com/android/platform_packages_apps_alarmclock

我最固定的,除了以下内容:

I fixed most of the except the following:

Alarms.java:
463线:意向alarmChanged =新意图(Intent.ACTION_ALARM_CHANGED);
错误:ACTION_ALARM_CHANGED不能得到解决或不是一个字段

Alarms.java: Line 463: Intent alarmChanged = new Intent(Intent.ACTION_ALARM_CHANGED); Error: ACTION_ALARM_CHANGED cannot be resolved or is not a field.

没能得到这个固定。搜索最让和谷歌组。没有完美的解决方案。

Not able to get this fixed. searched most of SO and Google group. No perfect solution.

我正在minSDK 9和目标18。

I am running minSDK for 9 and target of 18.

有人可以帮我修复这个吗?

Can somebody help me out fix this up?

谢谢!

推荐答案

你所下载的是不是一个真正的示例,而是一个系统应用程序的源。因此,它可以访问你不能正常访问自己SDK的某些部分,因为应用程序被直接内置了对Android的源$ C ​​$ C。

What you downloaded isn't really an 'example', but rather the source of a system application. As such, it has access to certain parts of the SDK that you can't normally access yourself, because the app gets built directly against the source code of Android.

如果你看看意图源$ C ​​$ C,你会发现下面的代码片段:

If you look at the Intent source code, you'll find the following snippet:

/**
 * Alarm Changed Action: This is broadcast when the AlarmClock
 * application's alarm is set or unset.  It is used by the
 * AlarmClock application and the StatusBar service.
 * @hide
 */
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED";

请注意在Javadoc中的最后一行 @hide 注释。这表明常数不是公共的Andr​​oid SDK的一部分。构建过程中,创造了Android SDK的一部分将不包括该成员的存根版 android.content.Intent 是在的android您对编译的.jar 文件。

Note the @hide annotation at the last line of the Javadoc. This indicates that the constant is not part of the public Android SDK. The part of the build process that creates the Android SDK will not include this member in the stub edition of android.content.Intent that is in the android.jar file that you are compiling against.

@hide 标注可用于改变,对于以公共需要内部用途或保护,但一些开发人员的SDK,应使用不考虑。

The @hide annotation is used for things that for internal purposes needed to be public or protected but are not considered something SDK developers should be using.

另请参阅 @ CommonWare的回答对此事,或的罗曼盖伊的超过在谷歌论坛

简而言之:你不能使用常量。你可以尝试用其字符串值(android.intent.action.ALARM_CHANGED)替换它,但要记住,可能有一个很好的理由不被提供给开发它。知道了,你应该不会试图在所有使用它。

In short: you can't use that constant. You could try replacing it with its string value ("android.intent.action.ALARM_CHANGED"), but remember that there's probably a good reason for it not being available to developers. Knowing that, you should really not be attempting to use it at all.

这篇关于从GIT闹钟 - 给出错误 - Android电子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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