ViewPagerIndicator

2019-07-30 11:06发布

问题:

I try to use viewpagerindicator but somehow the Console error always show this:

E/AndroidRuntime(871): Caused by: java.lang.ClassNotFoundException: com.viewpagerindicator.TitlePageIndicator in loader dalvik.system.PathClassLoader

I have included the viewpagerindicator as library. Can anyone help pls?

回答1:

Try this: Right click on the project. Select Properties. Go to Java Build Path and make sure your library is checked. Once you ensure that it is checked, clean the project and then run your project. This should resolve your issue.



回答2:

Include it in the Gradle build files instead, there is 2 files :

build.gradle located in "app" folder and another located in the root project folder.

Update the "dependencies" section in the first one as follows :

dependencies {
   /..... other libs
   compile 'com.viewpagerindicator:library:2.4.1@aar'
   /.... other libs
}

And update the "allprojects" section in the second one as follows :

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
    }
}


回答3:

I had lots of problems with viewpagerindicator until I switched my JDK over to the 32 bit version.

See https://stackoverflow.com/a/12831327/1116861 for more info.



回答4:

You must add libraries to the project.

First Do this;

File > Import > Android > Existing Android Code Into Workspace

Second Add Libraries into your project by;

Project Properties > Android > Scroll Down and Add required Libraries

-

I am not sure but This example may help you out; Making ActionBarSherlock and ViewPagerIndicator play nice

You may also come across a bug mentioned here; Android - SupportMapFragment with GoogleMaps API 2.0 giving IllegalArgumentException

Thats how I got my ViewPagerIndicator working..

Good Luck..!!