当我在我的项目上运行 Android Lint 时,我收到以下警告:
The org.slaytanic.SIMLockedRingNotifier.SIMLockedRingNotifierActivity is not registered in the manifest
Issue: Ensures that Activities, Services and Content Providers are registered in the manifest
Id: Registered
Activities, services and content providers should be registered in the AndroidManifext.xml file using , and tags.
If your activity is simply a parent class intended to be subclassed by other "real" activities, make it an abstract class. http://developer.android.com/guide/topics/manifest/manifest-intro.html
SIMLockedRingNotifierActivity.java
package org.slaytanic.SIMLockedRingNotifier;
public class SIMLockedRingNotifierActivity extends Activity {
[...]
AndroidManifest.xml
<application
android:icon="@drawable/application_icon"
android:label="@string/app_name" >
<activity
android:name=".SIMLockedRingNotifierActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
[...]
我还尝试用完整路径替换 Activity 的 android:name 属性android:name="org.slaytanic.SIMLockedRingNotifier.SIMLockedRingNotifierActivity"
但我明白了同样的警告。该应用程序运行完美,并且该 Activity 已正确添加到启动器中。我怎样才能摆脱它?我错过了什么吗?
最佳答案
我在 Eclipse 中测试了两个快速应用程序,看起来 Lint 无法确定是否正确添加了使用大写字符的“非标准”包名称的 Activity
AndroidManifest.xml
。
问题记录在他们的 bug tracker 中已经。
关于Android Lint 提示 Activity 未在 AndroidManifest 中注册,但它是,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10868431/