tablayout.setupWithViewPager( viewPager)崩溃

我试图使用Adapter在我的项目之一。但是出错了。

当我添加compile 'io.realm:android-adapters:1.0.1'到 gradle 文件。项目获取编译成功,但应用程序崩溃对tabLayout.setupWithViewPager(viewPager);— — 在这里我添加的行viewpager到 tabLayout。

应用程序成功运行时我评论compile 'io.realm:android-adapters:1.0.1'

我附上的活性截图在哪里它崩溃。57 行其崩溃。我也有贴上错误的栈跟踪

tablayout.setupWithViewPager( viewPager)崩溃_第1张图片

05-0922:11:48.07416932-16932/com.app E/AndroidRuntime:FATAL EXCEPTION:main

Process:com.app,PID:16932

java.lang.NoClassDefFoundError:Failedresolution of:Landroid/support/v7/widget/TintManager;

at android.support.design.widget.TabLayout$TabView.(TabLayout.java:1185)

at android.support.design.widget.TabLayout.createTabView(TabLayout.java:656)

at android.support.design.widget.TabLayout.addTabView(TabLayout.java:695)

at android.support.design.widget.TabLayout.addTab(TabLayout.java:386)

at android.support.design.widget.TabLayout.addTab(TabLayout.java:361)

at android.support.design.widget.TabLayout.setTabsFromPagerAdapter(TabLayout.java:645)

at android.support.design.widget.TabLayout.setupWithViewPager(TabLayout.java:616)

at com.app.MainActivity.onCreate(MainActivity.java:57)

at android.app.Activity.performCreate(Activity.java:6251)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)

at android.app.ActivityThread.-wrap11(ActivityThread.java)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5422)

at java.lang.reflect.Method.invoke(NativeMethod)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Causedby:java.lang.ClassNotFoundException:Didn't find class "android.support.v7.widget.TintManager" on path: DexPathList[[zip file "/data/app/com.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.app-1/lib/arm64, /data/app/com.app-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]

at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

at java.lang.ClassLoader.loadClass(ClassLoader.java:511)

at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

at android.support.design.widget.TabLayout$TabView.(TabLayout.java:1185)

at android.support.design.widget.TabLayout.createTabView(TabLayout.java:656)

at android.support.design.widget.TabLayout.addTabView(TabLayout.java:695)

at android.support.design.widget.TabLayout.addTab(TabLayout.java:386)

at android.support.design.widget.TabLayout.addTab(TabLayout.java:361)

at android.support.design.widget.TabLayout.setTabsFromPagerAdapter(TabLayout.java:645)

at android.support.design.widget.TabLayout.setupWithViewPager(TabLayout.java:616)

at com.app.MainActivity.onCreate(MainActivity.java:57)

at android.app.Activity.performCreate(Activity.java:6251)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)

at android.app.ActivityThread.-wrap11(ActivityThread.java)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5422)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Suppressed: java.lang.ClassNotFoundException: android.support.v7.widget.TintManager

at java.lang.Class.classForName(Native Method)

at java.lang.BootClassLoader.findClass(ClassLoader.java:781)

at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

at java.lang.ClassLoader.loadClass(ClassLoader.java:504)

... 21 more

Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

这里是从应用程序-build.gradle 文件的片段

dependencies{

compile fileTree(dir:'libs',include:['*.jar'])

testCompile'junit:junit:4.12'

compile'com.android.support:appcompat-v7:23.1.0'

compile'com.android.support:design:23.1.1'

compile'com.jakewharton:butterknife:7.0.1'

compile'com.rengwuxian.materialedittext:library:2.1.4'

compile'com.android.support:cardview-v7:23.1.0'

compile'com.github.paolorotolo:appintro:3.2.0'

compile'io.realm:android-adapters:1.0.1'

}

解决方法 1:

所有支持 libs 必须都具有相同的版本。23.1.0 或 23.1.1 或任何其他的.

但你不能使用不同的版本。

所以尝试使用23.3.0的所有库。

compile fileTree(dir:'libs',include:['*.jar'])

testCompile'junit:junit:4.12'

compile'com.android.support:appcompat-v7:23.3.0'

compile'com.android.support:design:23.3.0'

compile'com.jakewharton:butterknife:7.0.1'

compile'com.rengwuxian.materialedittext:library:2.1.4'

compile'com.android.support:cardview-v7:23.3.0'

compile'com.github.paolorotolo:appintro:3.2.0'

compile'io.realm:android-adapters:1.0.1'

你可能感兴趣的:(tablayout.setupWithViewPager( viewPager)崩溃)