eclipse错误:parseSdkContent failed Could not initialize class android.graphics

来源:互联网 发布:索尼kdl60w600b装软件 编辑:程序博客网 时间:2024/05/20 22:38

自从我安装了Android Studio,eclipse就出现了问题,这个问题困扰了我几天,仅此记录。


因为安装Android Studio同时安装了自带的Android SDK,自带的SDK是android6.0版本。

于是,在我的windows上同时存在两个Android SDK,我想各自用自己的,eclipse就出现了问题。


eclipse从外部导入工程是没问题的,但是新建工程就出现了问题:

ERROR:parseSdkContent failed Could not initialize class android.graphics

或者

ERROR:parseSdkContent failed Could not initialize class android.graphics.Typeface


我在网上找了N多答案,常见有以下版本,仅供尝试:

开Eclipse出现错误“parseSdkContent failed”,Android的模拟器启动不了。尝试了不少方法,终于搞定。

1.删除文件夹 C:\Documents and Settings\covics\.android  网上一般就只有这一步,为的是删除AVD的镜像文件,但是我删除后却依然不行。

2.重装Eclipse,因为是绿色版,所以就是删除原来的Eclipse文件夹后,再解压一个完全未配置的Eclipse就行了。然后再重新安装ADT及Android SDK(重新在Eclipse配置下路径就可以)。这一步我做了,但是貌似不是必需的,可以略过。

3.删除工作目录下的的.metadata文件夹   例如:E:\Android\workspace\.metadata

重启Eclipse后即可正常。


我试了后,问题依旧存在,我隐隐感觉到是两个版本SDK问题所致,但不知何故。

于是我又找到了一种解决方案:

Here is another cause and fix that might help .. This is happening because of existence of 2 versions of SDK in the same machine but in case you have only one version (probably it is 21) just download the SDK platform for API 20 (4.4W) as there is a problem in 21's "layoutlib.jar"). start applying the following:

  • Close Eclipse

  • Navigate to your sdk folder (something like C:\adt-bundle-windows-x86_64-20140321\sdk)

  • Go to platforms folder -> android-21 folder -> data folder and rename layoutlib.jar (for backup only)

  • Copy the same file (layoutlib.jar) from your android-20 folder to this folder "android-21"

  • Start Eclipse

简单来说就是:

1、首先,关闭你的eclipse。

2、在你的SDK目录,找到sdk/platforms/android-21/data文件夹。

3、找到layoutlib.jar文件并创建副件,也就是备份一个。

4、然后找到android-20/data文件夹,找到layoutlib.jar文件,复制到android-21/data文件夹覆盖。

5、打开eclipse,新建工程,不再出现错误。


看这问题的解决办法,应该是android-21的layout源错误,怪不得我新建工程后报错,

说是找不到style下的v-21什么的。


解决方案来源:

eclipse - parseSdkContent failed Could not initialize class android.graphics.Typeface - Stack Overflow

http://stackoverflow.com/questions/24636393/parsesdkcontent-failed-could-not-initialize-class-android-graphics-typeface

0 0