2015-07-21 86 views

回答

0
错误

要添加此库:

使用Eclipse:

创建基于支持库代码库项目:

Make sure you have downloaded the Android Support Library using the SDK Manager. 
1. Create a library project and ensure the required JAR files are included in the project's build path: 
    2. Select File > Import. 
    3. Select Existing Android Code Into Workspace and click Next. 
    4. Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to <sdk>/extras/android/support/v7/appcompat/. 
    5. Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat. 
    6. 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 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path. 
    7. Right-click the library project folder and select Build Path > Configure Build Path. 
    8. 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 appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files. 
    9. Uncheck Android Dependencies. 
    10.Click OK to complete the changes. 

您现在有一个用于选定支持库的库项目,可以与一个或多个应用程序项目一起使用。

库添加到您的应用程序项目:

  1. 在Project Explorer中,右键单击您的项目并选择属性。
  2. 在对话框左侧的类别面板中,选择Android。
  3. 在“库”窗格中,单击“添加”按钮。
  4. 选择库项目并单击确定。例如,appcompat项目应该被列为android-support-v7-appcompat。
  5. 在属性窗口中,单击确定。

使用过Android Studio:

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


1. Open the build.gradle file for your application. 
2. Add the support library feature project identifier to the dependencies section. For example, to include the appcompat project add compile "com.android.support:appcompat-v7:18.0.+" to the dependencies section, as shown in the following example: 

dependencies { 
    ... 
    compile "com.android.support:appcompat-v7:18.0.+" 
} 
+0

我的错误按照上面提到的步骤,但仍然android.support库无法在我的项目中解决...谢谢 –

+0

使用Android Studio,你应该提供一个更新的例子。 18.0 +很老... –

+0

这只是一个例子,可以根据需要进行修改。参考 - developer.android.com –

1
在你的项目属性

改变你的目标android-21.you应该有最新的API 21 SDK平台

+0

尝试在示例 –

+1

中打开project.properties,然后更改target = android-21 –