laobie / StatusBarUtil

A util for setting status bar style on Android App.
http://t.cn/Rq746Kb
Apache License 2.0
8.81k stars 1.72k forks source link

我的Activity继承的是FragmentActivity请问可以用吗? #72

Closed Object-Ping closed 7 years ago

Object-Ping commented 7 years ago

我试了一下会报错! setSupportActionBar(mToolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } 找不到,请问怎样才能兼容呢?

laobie commented 7 years ago

@Object-Ping FragmentActivity 没有 actionBar 这个工具类对 activity 父类是啥没要求的,请自行排查

Object-Ping commented 7 years ago

12-13 15:25:35.231 25682-25682/? E/aiyinsitan:java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/internal/widget/TintManager; at android.support.design.widget.TabLayout$TabView.(TabLayout.java:1145) at android.support.design.widget.TabLayout.createTabView(TabLayout.java:635) at android.support.design.widget.TabLayout.addTabView(TabLayout.java:669) at android.support.design.widget.TabLayout.addTab(TabLayout.java:365) at android.support.design.widget.TabLayout.addTab(TabLayout.java:340) at com.fm.aiyinsitan.fragment.HomeFragment.initPager(HomeFragment.java:66) at com.fm.aiyinsitan.fragment.HomeFragment.onBindVu(HomeFragment.java:42) at com.fm.aiyinsitan.base.BaseFragment.onCreateView(BaseFragment.java:88) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1677) at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:604) at com.fm.aiyinsitan.base.BaseActivity.onStart(BaseActivity.java:309) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1266) at android.app.Activity.performStart(Activity.java:6943) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3276) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) at android.app.ActivityThread.access$1100(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7406) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.internal.widget.TintManager" on path: DexPathList[[zip file "/data/app/com.fm.aiyinsitan-2/base.apk"],nativeLibraryDirectories=[/data/app/com.fm.aiyinsitan-2/lib/arm, /data/app/com.fm.aiyinsitan-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] 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:1145)  at android.support.design.widget.TabLayout.createTabView(TabLayout.java:635)  at android.support.design.widget.TabLayout.addTabView(TabLayout.java:669)  at android.support.design.widget.TabLayout.addTab(TabLayout.java:365)  at android.support.design.widget.TabLayout.addTab(TabLayout.java:340)  at com.fm.aiyinsitan.fragment.HomeFragment.initPager(HomeFragment.java:66)  at com.fm.aiyinsitan.fragment.HomeFragment.onBindVu(HomeFragment.java:42)  at com.fm.aiyinsitan.base.BaseFragment.onCreateView(BaseFragment.java:88)  at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1677)  at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)  at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:604)  at com.fm.aiyinsitan.base.BaseActivity.onStart(BaseActivity.java:309)  at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1266)  at android.app.Activity.performStart(Activity.java:6943)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3276)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)  at android.app.ActivityThread.access$1100(ActivityThread.java:229)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:7406)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)  Suppressed: java.lang.ClassNotFoundException: android.support.v7.internal.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) ... 29 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available java.lang.ClassNotFoundException: Didn't find class "android.support.v7.internal.widget.TintManager" on path: DexPathList[[zip file "/data/app/com.fm.aiyinsitan-2/base.apk"],nativeLibraryDirectories=[/data/app/com.fm.aiyinsitan-2/lib/arm, /data/app/com.fm.aiyinsitan-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] 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:1145) at android.support.design.widget.TabLayout.createTabView(TabLayout.java:635) at android.support.design.widget.TabLayout.addTabView(TabLayout.java:669) at android.support.design.widget.TabLayout.addTab(TabLayout.java:36 12-13 15:25:35.231 25682-25738/? E/Qmage: isQIO : stream is not a QIO file 12-13 15:25:36.021 6463-6463/? E/Qmage: isQIO : stream is not a QIO file 12-13 15:25:36.271 25744-25744/? E/Zygote: v2 12-13 15:25:36.271 25744-25744/? E/Zygote: accessInfo : 0 12-13 15:25:36.521 3559-6618/? E/MARsPolicyManager: Package: com.jingdong.app.mall hostingType: broadcast is Restricted by policy: autorunpolicy(4) caller is: null

Object-Ping commented 7 years ago

一直在报这个错误,并且我已经加如下依赖: compile 'com.android.support:support-v4:23.0.1' compile 'com.android.support:recyclerview-v7:23.0.1' compile 'com.android.support:design:23.0.1' compile 'com.jaeger.statusbaruitl:library:1.3.1' compile 'com.android.support:appcompat-v7:23.0.1'

Object-Ping commented 7 years ago

应该是你library的24.0.2的库大于我的版本。

laobie commented 7 years ago

@Object-Ping

compile 'com.jaeger.statusbaruitl:library:1.3.1'{
    exclude group: 'com.android.support', module: 'support-v7'
}

排除即可,或者你升级一下你的 support 依赖

Object-Ping commented 7 years ago

我也不知道为什么,没引用你library时是没有任何报错的,引入了你的依赖就会报错,并且不停的循环,当前界面假死。

laobie commented 7 years ago

@Object-Ping 具体的错误分析自己排查,实在不行,简单写个 demo 看看是否有问题 ok ?

Object-Ping commented 7 years ago

我把你的文件直接copy到我的项目再看看,很高兴能得到谢谢你的回复!

laobie commented 7 years ago

@Object-Ping ok