微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – 如何摆脱警告:使用’$’代替’.’对于Eclipse中的内部类

我是 Android开发的新手.当我将eclipse和Android SDK更新到最新版本后,我发现了一个警告:
Use '$' instead of '.' for inner classes (or use only lowercase letters in package names)   AndroidManifest.xml

在这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这样的子包名称中的大写字符.

问题是:在manifest.xml中摆脱这个警告的最好办法是什么?它仍然可以建立和运行,但我觉得这么烦人.

我尝试使用refactor来重命名包,并修改了manifest.xml android:name =“com.abc.app.promotion.Promotion”,但是得到了这个错误

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

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

更新了manifest.xml

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

解决方法

如果您对于实际上不是内部类的类收到此警告,那是因为您在包名称中使用大写字符,这不是传统的.

我也尝试只改变包名的第一个字母为小写,警告消失了.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐