2014-10-29 8 views
1

스타일 가능한 속성에 대한 참조를 생성 할 때 R.java 파일 생성시 문제가있는 것으로 보입니다.R.java의 참조가 최종적이 아님

필드의 선언이 final 일 것으로 예상되지만 그렇지 않습니다. 어째서?

고해상도/값/attrs.xml이

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <declare-styleable name="MyTextView"> 
     <attr name="typeface" format="string"/> 
    </declare-styleable> 
</resources> 

세대/com.example/R.java는 R.java 내부

/** 
     <p>This symbol is the offset where the {@link com.example.R.attr#typeface} 
     attribute's value can be found in the {@link #MyTextView} array. 
     <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. 
     <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>: <i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>: [<i>type</i>:]<i>name</i></code>") containing a value of this type. 
     @attr name com.example:typeface 
    */ 
    public static int MyTextView_typeface = 0; 
+0

http://tools.android.com/tips/non-constant-fields 어떻게'R.java' 생성 (왜) 내가 여기에 누군가가 –

+0

체크 아웃 업데이트 jucas '대답에 대답 할 수 있다고 생각하지 않는 일부 내부입니다. 맞습니다. –

답변

3

참조 전에 몇 년 이후 최종되지 않습니다.

주 프로젝트가 의존하는 여러 개의 라이브러리 프로젝트가있는 경우 생성 된 ID가 충돌 할 수 있습니다.

다음은이에 대한 자세한 설명입니다

+0

감사합니다! 이 문제는 코드를 라이브러리로 옮긴 후에 발생하므로 이제는 모두 이해가됩니다. – mach