Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add android support library v4 to intellij ide

I am trying to use viewpager from android support library v4 in intelli j. Currently, I am using the Android SDK 4.1

I copied android-support-v4.jar to my intellij android project under 'libs'

in the project settings of intellij

I went to "Modules" => "MyModuleName" => dependencies tab, and add the android-support-v4.jar, by navigating the path to the libs/ folder under my own project

I checked the 'export' besides this newly added jar file

but I still can't use viewpager in my application.

I get a crash msg like:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxx/com.xxxx.MyActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class android.support.v4.view.ViewPager
like image 615
user1233587 Avatar asked Oct 18 '12 04:10

user1233587


1 Answers

I've inspected the project you provided and found the problem to be caused by the incorrect library configuration. When adding a library, you've specified android folder inside the jar instead of specifying the jar itself.

Incorrect configuration:

incorrect

Correct configuration:

correct

like image 168
CrazyCoder Avatar answered Oct 31 '22 05:10

CrazyCoder