近期在更改程序架构的时候,用引用Library的方式实现程序的共享化过程中发现R.id.xx的文件不能够在  switch cases  中使用

看代码提示,如下信息:
As of ADT 14, resource fields cannot be used as switch cases.   In other words, the constants are not final in a library project. The reason for this is simple: When multiple library projects are combined, the actual values of the fields (which must be unique) could collide. Before ADT 14, all fields were final, so as a result, all libraries had to have all their resources and associated Java code recompiled along with the main project whenever they were used. This was bad for performance, since it made builds very slow. It also prevented distributing library projects that didn't include the source code, limiting the usage scope of library projects.


解决的方法是把switch cases 改成 if else的方式,在eclipse中可以使用 
ctrl+1快捷方式切换。

Android Migrate Android Code的更多相关文章

  1. Android app version code and name

    android:versionCode和android:versionName 区别   Android的版本可以在androidmainfest.xml中定义, 主要有android:version ...

  2. 【Android】Android Studio 进行代码混淆,打包release APK

    整了一天,感觉坑挺多. 1. 选择如图中的选项Android Studio进行签名打包: 2. 填写APP对应的信息:(最好用个文本记下来放在项目中同步给Team) - Key store path: ...

  3. [Android Pro] android 4.4 Android原生权限管理:AppOps

    reference : http://m.blog.csdn.net/blog/langzxz/45308199 reference : http://blog.csdn.net/hyhyl1990/ ...

  4. 【Android】Android开源项目分类汇总

    第一部分 个性化控件(View) 主要介绍那些不错个性化的View,包括ListView.ActionBar.Menu.ViewPager.Gallery.GridView.ImageView.Pro ...

  5. android.mk android源码编译

    http://www.cnblogs.com/chenbin7/archive/2013/01/05/2846863.html Android.mk简单分析 2013-01-05 22:51 by . ...

  6. 【Android】Android 广播大全

    [Android]Android 广播大全 String ADD_SHORTCUT_ACTION 动作:在系统中添加一个快捷方式. String ALL_APPS_ACTION 动作:列举所有可用的应 ...

  7. 【转】【Android】Android Studio打包全攻略

    项目写完了,现在需要把应用上传到市场,问题出现—怎么把代码变成.apk(Android的可安装文件).1. 创建签名文件2. 填写好签名参数3. 生成APK注意:签名的密码和密匙的密码注意保管,不要忘 ...

  8. android第三方---->android智能机器人的使用

    在网上找了个第三方智能机器人,可以实现聊天语音等功能,比较不错的.今天我们就开始智能机器人聊天的学习,例子中涉及的handler的有关知识和json数据的解析,请参见我的博客:android基础--- ...

  9. [Android Studio] Android Studio常用快捷键

    [Android Studio] Android Studio常用快捷键   (会持续更新)这边讲的常用快捷键是指做完Keymap到Eclipse后的,不是纯Android Studio的,这边主要讲 ...

随机推荐

  1. 吴恩达-coursera-机器学习-week1

    一.引言(Introduction) 1.1 欢迎 1.2 机器学习是什么? 1.3 监督学习 1.4 无监督学习 二.单变量线性回归(Linear Regression with One Varia ...

  2. Linux学习笔记05—文件与目录权限

    1. 绝对路径与相对路径绝对路径:路径的写法一定由根目录 ‘/’写起,例如 /usr/local/mysql 这就是绝对路径相对路径:路径的写法不是由根目录 ‘/’写起,例如:首先用户进入到/, 然后 ...

  3. #pragma pack(n)的使用

    在缺省情况下,编译器为了让程序跑得跟快,减少CPU读取数据的指令周期,对结构体的存储进行了优化, 比如:如下结构体 struct s { char ch; int i; }; 虽然变量ch本身只有1个 ...

  4. spring-boot 速成(12) - 如何注入多个redis StringRedisTemplate

    默认情况下,spring-boot的redis自动配置,只能注册一个StringRedisTemplate实例,如果希望注入多个,比如:1个读写database 0,1个读写database 1 .. ...

  5. Entity framework 增加默认执行时间

    public partial class ProductionSupportEntities : DbContext { public ProductionSupportEntities() : ba ...

  6. 解决xib布局方式支持ios6,ios7

    xcode5 中的界面布局 根据sdk 分成ios7.0 and Later 和 ios6.1 and Earlier 两种,那如何xib同时支持 ios6 和ios7 的界面呢 方法如下: 在xco ...

  7. WebRTC 基于GCC的拥塞控制(上)

    转自:http://blog.csdn.net/doitsjz/article/details/56481981 实时流媒体应用的最大特点是实时性,而延迟是实时性的最大敌人.从媒体收发端来讲,媒体数据 ...

  8. 关于 java.lang.IllegalStateException: invocation

    由于在 quartz 的 job 中有引用其它 service(这个 service 中又引用了 inv.getRequest() ) ,所以报以上错误了...还没有找到解决办法

  9. libcurl上传文件

    libcurl参数很多,一不小心就容易遇到问题.曾经就遇到过一个很蛋疼的问题:libcurl断点下载>>   这里主要汇总一下,libcurl上传的二种方式: 1.直接上传文件,类似for ...

  10. [Web 前端] 如何构建React+Mobx+Superagent的完整框架

    ReactJS并不像angular一样是一个完整的前端框架,严格的说它只是一个UI框架,负责UI页面的展示,如果用通用的框架MVC来说,ReactJs只负责View了,而Angular则是一个完整的前 ...