Some jar(v4 support, ActionBarSherlock and etc.) import error in Android Studio
2013-05-19 15:29
381 查看
How to configure ActionBarSherlock with Intellij IDEA
[Original URL:http://android-wtf.com/2012/09/how-to-configure-actionbarsherlock-with-intellij-idea/]11
Replies
Introduction
This tutorial will guide you through the steps to set up ActionBarSherlock (ABS fromnow on) with your Android project created using Intellij IDEA. Just for the record,
I’m using ABS version 4.1.0 and IDEA version 11.1.3.
Requirements
You must target API level 14 (Android 4.0) or higherYou must install the Android Support Library using SDK Manager, since ABS depends on it
As a rule, you should always target the latest API version to avoid enabling unnecessary compatibility behaviors, to take advantage of the latest platform improvements and optimizations. ABS, in turn, will use the platform’s native
ActionBarimplementation
instead of it’s own backport. As far as ABS is concerned, minimum SDK version can be as low as 7 (Android 2.1).
Step 1: Download ActionBarSherlock
Download and extract ActionBarSherlock, preferably to the same directorywhere your projects reside. By default, it is
C:\Users\<Name>\IdeaProjectson
Windows 7.
If you prefer Git, clone and checkout the latest stable version.
Step 2: Create a module with Intellij IDEA
Switch to IDEAOpen
File > Project Structure
Select
Moduleson the left pane
Click on the plus sign above the second column, and choose
Module
Add Modulewindow will appear. Select the
Create module from existing sourcesoption
Click on the button right next to the textbox
A tree-based directory chooser dialog will pop up. Within the dialog navigate to the ABS directory, and choose the
librarysubdirectory
Click
OKto dismiss the dialog
Back in the
Add Modulewindow, click
Nextas
many times as needed
Click
Finish
Select your application module in the
Modulespane
Activate the
Dependenciestab, then click on the plus sign on the right, and select
Module dependency...
Select the ABS library and click
OK
Finally click
OKto close the
Project Structurewindow
Step 3: Add Android Support Library
Copy the jar file <sdk>\extras\android\support\v4\android-support-v4.jarto your
project’s
libsdirectory (create one if it doesn’t exist)
Switch to IDEA
Open
File > Project Structureif you have closed it
Select
Librariesfrom the left pane
Click on the plus sign above the second column, and choose
Java
From the file-chooser popup, navigate to your project’s
libsdirectory
Choose the jar you copied earlier, and click
OK
A popup titled
Choose Moduleswill appear
Select both modules, and click
OK
Click
OKto apply the changes in the
Project Structurewindow
Conclusion
That’s it. You should now be able to use ActionBarSherlock in your project. Just don’t forget to extend the SherlockActivityclass
instead of the native
Activityclass. If anything goes wrong, let me know in
the comments.
相关文章推荐
- (Android)actionbarsherlock getSupportActionBar() return null in android4.0,but in 2.3.3 is ok
- Error:Conflict with dependency 'com.android.support:support-v4' in project ':app'...解决方案
- 错误:Found both android-support-v4 and android-support-v13 in the dependency list.
- 【Android】Do not requestWindow.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your th
- AndroidStudio编译错误:Error: null value in entry: blameLogFolder=null
- Android Studio Error:null value in entry: outputDirectory=null编译报错问题
- Gradle error : Write access is allowed from event dispatch thread only in android studio
- "Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.".
- Error : should use android:showAsAction when not using support library
- Android Studio出现 No service of type Factory available in ProjectScopeServices. Error解决方案
- 解决Error inflating class android.support.design.widget.FloatingActionButton
- Why am I getting this error “Expected resource of type raw” in Android Studio?
- Error: Flag android.useDeprecatedNdk is no longer supported and will be removed in the next version
- Android Studio出现Error:No service of type Factory available in ProjectScopeServices.
- Jdk 8下运行Android-studio或者Eclipse时 ignoring option MaxPermSize=350m; s support was removed in 8.0的探讨
- Error: Could not find an installed version of Gradle either in Android Studio
- Error:(22, 13) Failed to resolve: com.android.support:appcompat-v7:14.+ <a href="install.m2.repo">In
- Error inflating class android.support.design.widget.FloatingActionButton
- libpng error: Not a PNG file Error Showing In Android Studio
- Android studio Error :...you can't have non-Gradle Java modules and Android-Gradle modules ...