如何摆脱警告:使用'$'而不是'。'对于Eclipse中的内部类 [英] How to get rid of the warning: Use '$' instead of '.' for inner classes in Eclipse

查看:78
本文介绍了如何摆脱警告:使用'$'而不是'。'对于Eclipse中的内部类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android开发的新手。在我将eclipse和Android SDK更新到最新版本后,我收到了警告:

I am new to Android development. After I updated my eclipse and Android SDK to the newest version, I got an warning:

Use '$' instead of '.' for inner classes (or use only lowercase letters in package names)   AndroidManifest.xml

我找到了一些信息在此链接

I Found some information on this link.

"When you reference an inner class in a manifest file, you must use '$' instead of '.' " +
    "as the separator character, e.g. Outer$Inner instead of Outer.Inner.\n" +
    "\n" +
    "(If you get this warning for a class which is not actually an inner class, it's " +
    "because you are using uppercase characters in your package name, which is not " +
    "conventional.)"

我相信我在中使用了大写字符子包名称如 com.abc.app.Promotion

I believe that I used uppercase characters in sub package name like com.abc.app.Promotion.

问题是:什么是最好的方法在manifest.xml中摆脱这个警告?它仍然可以构建和运行,但我发现它很烦人。

The question is: What is the best way to get rid of this warning in the manifest.xml? It still can build and run but I find it so annoying.

我尝试使用重构来重命名包并修改了manifest.xml android: name =com.abc.app.promotion.Promotion但收到此错误:

I tried using refactor to rename the package and modified the manifest.xml android:name="com.abc.app.promotion.Promotion" but got this error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.app/com.abc.app.TabView}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.abc.app/com.abc.app.promotion.Promotion}; have you declared this activity in your AndroidManifest.xml?

感谢您的帮助!

编辑:
原始manifest.xml

original manifest.xml

<activity android:name=".Promotion.Promotion" ></activity>

更新manifest.xml

updated manifest.xml

<activity android:name="promotion.Promotion" ></activity>


推荐答案

如果您收到此类警告实际上是一个内部类,这是因为你在包名中使用了大写字符,这不是传统的。

If you get this warning for a class which is not actually an inner class, it's because you are using uppercase characters in your package name, which is not conventional.

我还试图只改变包名的第一个字母为小写,警告消失。

I tried also to change only the first letter of the package name to be lower case, the warning disappeared.

这篇关于如何摆脱警告:使用'$'而不是'。'对于Eclipse中的内部类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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