被Eclipse中Android依賴項目無法關聯源代碼的問題困擾了許久,終於得到解決,大大提高了開發效率。
問題描述:
項目有A,B兩個Android Project組成, B是Android Library(android.library=true), A引用了B.
現在在A項目代碼里點擊B項目的類,想查看定義, 不能直接打開B項目的源碼(提示:The JAR of this class file belongs to container 'Android Dependencies' which does not allow modifications to source attachments on its entries.)
解決方法:
在代碼被依賴的項目的.classpath文件中,將引用主要代碼的那行放在第一行,而不是其它java代碼,特別不能是gen文件夾
<classpathentry kind="src" path="src/java"/>