Android Lib Project与Android Project中R文件的区别

Android Lib Project中生产的R文件内,,都不是常量。

/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */public final class R {public static final class string {public static int action_settings=0x7f050001;public static int app_name=0x7f050000;public static int hello_world=0x7f050002;}}

Android Project中生产的R文件内,都是常量。

/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */public final class R {public static final class string {public static final int action_settings=0x7f050001;public static final int app_name=0x7f050000;public static final int hello_world=0x7f050002;}}

所以当你的项目中有用到switch的地方,同时条件又用到了 R 中的常量时,将此project转成lib project的话就会报错。要求你将 switch-case 换成 if-else。

As of ADT 14, resource fields cannot be used as switchcases. Invoke this fix to get more information.

只是微笑地固执自己的坚持,

Android Lib Project与Android Project中R文件的区别

相关文章:

你感兴趣的文章:

标签云: