今天导入一个项目,发现运行不能,红叉叉表示com.android.internal.R.的一系列引用都失败。

查了一下,这些都在一个SDK自带包layoutlib.jar中。SDK路径\platforms\api版本\data 下就有 layoutlib.jar

直接把这些扔到libs文件夹中,红叉叉消失,运行又报错:Conversion to Dalvik format failed with error 1


上网查了一下,大概意思是包中资源与项目资源引用冲突,于是继续查。


果然不负有心人,应该采用用户库的形式导入该库,具体步骤如下:

1. Right-click the project in Eclipse and select "Build Path -> Add Libraries...".
2. Select User Library from the list and click Next.
3. Click the "User Libraries..." button.
4. Click "New..." in the User Libraries dialog.
5. Give the user library a name and select the System library checkbox and click OK.
6. Highlight the newly added user library in the list and click the "Add JARs..." button and add the desired jar files.
7. Click OK on the User Libraries dialog.
8. Make sure the new user library is checked in the Add Library dialog and click finish.


按照上面的步骤,我命名库Layoutlib,再运行,还是报错。

仔细看了下项目中库jar包支持,发现自己的Layoutlib和系统的Android Private Libraries都引用了layoutlib.jar


layoutlib.jar从libs中拿出来放到应用根目录,把Layoutlib库指向新路径。

运行,成功!



更多相关文章

  1. android led_misc驱动 + 测试应用程序(ndk-build)
  2. ANDROID STUDIO&&Eclipse Android项目缺少R文件解决方法(完解)
  3. Content Provider使用方法以及Android运行时权限申请
  4. Java Android(安卓)注解(Annotation) 及几个常用开源项目注解原
  5. android 辅助工具类—— 图片缓冲池
  6. Android(安卓)编译命令及选项
  7. NDK DEBUG方法
  8. Android之解决java.lang.UnsatisfiedLinkError: dlopen failed:
  9. 【Android(安卓)Studio】制作启动画面Splash Screen

随机推荐

  1. 漫画设计模式:什么是 “职责链模式” ?
  2. 配置vscode的cmder的方法
  3. 前端杂记-环境搭建
  4. mysql 存在更新 不存在插入
  5. mysql创建存储过程失败1307错误解决
  6. 0506作业
  7. h5红包活动特辑,红包H5营销活动如何制作
  8. 随时随地创建在线考试,“无纸化”考试时代
  9. 游戏Python开发从青铜到王者,你必须了解哪
  10. Unity3D实现模型体积拖拽变化