如何在Eclipse里正确导入Android support v7 appcompat library

参考 http://stackoverflow.com/questions/26878803/how-to-add-android-support-v7-libraries-in-eclipse

步骤很详细,这个步骤说的是 android/support/v7/cardview 的导入过程,appcompat也一样,这里就不翻译了。


  • Make sure you have downloaded the Android Support Library using the SDK Manager.

  • Create a library project and ensure the required JAR files are included in the project's build path:

  • Select File > Import.

  • Select Existing Android Code Into Workspace and click Next.

  • Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the cardview project, browse to /extras/android/support/v7/cardview/.

  • Click Finish to import the project. For the v7 cardview project, you should now see a new project titled android-support-v7-cardview.

  • In the new library project, expand the libs/ folder, right-click each .jar file and select Build

  • Path > Add to Build Path. For example, when creating the the v7 cardview project, add the android-support-v7-cardview.jar file to the build path.

  • Right-click the library project folder and select Build Path > Configure Build Path.

  • In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the cardview project requires you to export the android-support-v7-cardview.jar file.

  • Uncheck Android Dependencies.

  • Click OK to complete the changes.

  • You now have a library project for your selected Support Library that you can use with one or more application projects.

  • Add the library to your application project:

  • In the Project Explorer, right-click your project and select Properties.

  • In the category panel on the left side of the dialog, select Android.

  • In the Library pane, click the Add button.

  • Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-cardview.

  • In the properties window, click OK.


需要注意project.properties里的target尽量高点比较好,如果低了可能会出现类似

No resource found that matches the given name '@style/Theme.AppCompat.Light'的问题。我选的是23。




  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值