什么是迁移Android代码? [英] What is Migrate Android Code?

查看:215
本文介绍了什么是迁移Android代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从ADT 14开始,资源字段不能用作switch
的情况。调用此修复程序以获取更多信息。这是什么原因?

As of ADT 14, resource fields cannot be used as switch cases. Invoke this fix to get more information. whats the reason this is used for?

推荐答案

看看关于这个的官方博文:

Take a look at the official blog post about this:

http://tools.android.com/recent/switchstatement转换

http://tools.android.com/tips/non-constant-fields

基本上,库项目中的资源常量不再是final。从ADT网站:

Basically, resource constants in library projects are no longer "final". From the ADT Site:


换句话说,常量不是库项目中的最后一个。
的原因很简单:当多个库项目是
组合时,字段的实际值(必须是唯一的)可以
冲突。在ADT 14之前,所有的字段都是最终的,所以所有的
图书馆必须将所有的资源和关联的Java代码
与主项目一起使用时重新编译。这个
对于性能不好,因为它的构建非常慢。它还
阻止分发不包含源
代码的图书馆项目,限制图书馆项目的使用范围。

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.

这篇关于什么是迁移Android代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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