Eclipse hangs at the Android SDK Content Loader

来源:互联网 发布:单片机最小系统图片 编辑:程序博客网 时间:2024/05/17 07:57

http://stackoverflow.com/questions/13489141/eclipse-hangs-at-the-android-sdk-content-loader


I've been working with Eclipse 4.2 (Juno release 20120920-0800) on OS X 10.8.2 for a few weeks now, building apps for Android 3.0 and above. I have a quad core i7 MacBook Pro with an SSD, so performance is not an issue. Everything was fine.


At some point I imported an Android project that required Android 2.2, so I installed that using the Android SDK manager (v.21). Ever since then, working with Eclipse takes forever. First of all, it will print the following in the status message at the bottom right:


Android SDK Content Loader: (0%)
This takes two minutes or so. The specific message is "Check Projects" and while it's doing that, all Android projects are highlighted in red, because the Android resources aren't found. Then, it proceeds with:


Loading data for Android 2.2 (100%)
This will stay for a couple of minutes. Then it goes on to do the same with Android 3.1 and other SDK versions I have installed. It basically hangs whenever the first autocompletion kicks in (e.g. after typing System.) or when I access the Android preferences before it has loaded.


Here's the state of my Android SDK:


This is the solution I found which works correctly:


Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
Open %USERPROFILE%/ on Windows or simply ~ on Linux/OS X (You can locate this folder from the Desktop)
Go to .android folder (This may be a hidden folder)
Delete the folder cache which is located inside .android folder
Delete the file ddms.cfg which is located inside .android folder
Start Eclipse
Same problem, stuck at 0%. Ran


/Applications/eclipse/eclipse -clean


and everything worked great again. Modify that path for linux boxes.


Update (from the remark from @Janusz )


For mac users with eclipse outside application directory your clean command will looks similar to:


path/eclipse/Eclipse.app/Contents/MacOS/eclipse -clean 


1.Eclipse项目中的Android Private Libraries没有自动生成。


一般而言,在Android开发中,项目中引用到的jar包会放到项目目录中的libs中,引入库会放到Android Dependencies中,对于放置于libs中的jar包,会自动置于项目中的Android Private Libraries下,如果没有自动生成,clean项目后一般在console下会发现有相应的错误提示,修正即可。如:项目中引用了不同的v4兼容包等会出现此类情况。


 


2.Eclipse中一直出现“Android SDK: resolving error markers”。


此类情况网上有诸多描述以及相应尝试性的解决方法,不久前本人即出现此类情况,尝试多种方案后未能解决。最终方法如下:


删除此文件,workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi,重启Eclipse即可。


3.Eclipse 中出现的错误警示:Element xxx is unknown.


在编写xml文件时,有时候当按下alt + / 本来想进行内容辅助时,有时候会总是出现Element xxx is unknown。原因在于此xml布局文件中写入了错误的标签/控件名称(eclipse是不会直接在不能识别的标签行前显示红叉的,xml文件本身也不会出现红叉),如xml中将FrameLayout写成了FragmentLayout等。


4.Eclipse中查看libs中的第三方jar包源码(如android-support-v4.jar)


在libs目录下建个和jar名字一样的 properties 文件,内容是src:源代码路径;doc:index.html的路径。


以v4 jar包为例


创建:


libs/android-support-v4.jar.properties
打开,编辑:


src = ..../android-sdk/extras/android/support/v4/src
保存后重启Eclipse。


 


5.升级SDK Manager后引起的Android Developer ToolKit版本不一致问题


在升级Android SDK Manager后,打开Android Adt Bundle出现错误提示:"This Android SDK requires Android Developer ToolKit version xxx or above",


原因是SDK Manager与Android Developer ToolKit版本不一致。


最后导致Android Adt Bundle无法使用。已有的项目出现无法生成R文件,同时也无法新建项目或导入外部项目。按照提示其实将Android Adt Bundle升级到相应本版即可。但是检查后发现Android Adt Bundle已是最新。


最后解决办法如下:


在SDK的Tools目录的lib中,知道打plugin.prop文件,将其中的plugin.version=xxx改为Android Adt Bundle当前的版本号xxx,然后重新启动Eclipse即可继续使用。


 


6.Using 1.7 requires compiling with Android 4.4 (KitKat); currently using 17


项目右键 >> java Compiler >> Compiler Compliance level 选择1.6。


 


7.Eclipse startup hang, “Android SDK: resolving error markers”


解决方案:删除文件/workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi,具体原因未知,若谁知道原因希望告知。


 


8.Eclpse Logcat中显示信息一小段时间后自动消失


解决方案:Logcat中的消息显示数量默认为5000条,可以适当增加此条目。Window >> Preferences >> Android >> LogCat >> Maximum number of logcat messages to buffer设置更大的数量


 


9./xxProject/gen already exists but is not a source folder. Convert to a source folder or rename it.


原因:直接导入外部项目时因classpath配置问题导致。


解决方法:


右键project >> Properties >> Java Build Path >> 选择Source >> Add Folder >> 选中gen文件夹 >> ok.. yes
最后右键Fix Project Properties 并 clean下项目。




0 0
原创粉丝点击