Android 工程重命名錯誤

今天在對一個安卓工程重命名時,遇到了下面的錯誤:

An unexpected exception occurred while creating a change object.See the error log for more details.

各種百度,Google之後,發現下面的結論:

You can not belive this. I have exactly the same problem and is because I comment a class entirely. So I think that when eclipse try to change the package name of a commented class it throw this error./ p1 Z  a+ E7 f1 y) \$ l) S8 M7 T
To solve the problem you only has to delete the class or uncomment it.

大意是說,工程中有註釋的類,將其找出,刪除或者解註釋即可。
8 t# G3 B$ k( O
本來,到這裏,應該告一段落,但是,我在刪除了工程中,註釋掉的類以後,還是有這個錯誤。: c: F/ j; ]1 ^
也許還有漏網之魚,還有其它被註釋掉的類沒有找出來。2 J& ]1 k3 a9 ~6 p$ t

同事提供了另外一種有效的方式:
1.修改AndroidManifest.xml中的包名。
2.在工程中的src目錄下,找到和App的包名一致的包,點右鍵,選擇Refactor->Rename..然後把包名改成自己想要的包名。
3.如果有編譯錯誤,比如佈局文件xml中有錯,按照提示修改錯誤就OK了。


原文:http://www.lephone.net/thread-13131-1-1.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章