您的位置:首页 > 移动开发

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

2016-10-13 15:35 561 查看
参考 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。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: