什么是迁移的Andr​​oid code?Andr、oid、code

2023-09-07 09:24:38 作者:归来酒未醒

作为ADT 14,资源字段不能被用作开关  案例。调用此修复程序,以获取更多信息。请告诉我这个原因是干什么用的?

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/switchstatementconversion

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

基本上,在库项目资源常量不再是最后。从ADT网站:

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

在换句话说,常量不是最终的库项目。该   原因很简单:当多个库项目   结合时,字段的实际值(必须是唯一的)可以   碰撞。 ADT 14之前,所有字段都最终,所以作为结果,所有的   库必须有他们所有的资源和相关的Java code   只要与他们所用的主要项目重新编译沿。本   是坏的性能,因为它使建立非常缓慢。它也是   prevented分发库项目,不包括源   code,限制了库项目的使用范围。

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.