0
私はアクションバーでデモアプリケーションを作成しました。 NavDrawerには2つの要素があり、異なる要素が読み込まれます。私がロードしようとすると。 Support.getFAQFragment(...)、次のエラーが表示されますHelpShiftフラグメントをロードしようとするとインフレータブル例外が発生する
Process: com.helpshiftdemo.baumar.helpshiftdemo, PID: 20357
android.view.InflateException: Binary XML file line #10: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:621)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:40)
at android.support.v4.view.MenuItemCompat.setActionView(MenuItemCompat.java:310)
at android.support.v7.view.SupportMenuInflater$MenuState.setItem(SupportMenuInflater.java:465)
at android.support.v7.view.SupportMenuInflater$MenuState.addItem(SupportMenuInflater.java:479)
at android.support.v7.view.SupportMenuInflater.parseMenu(SupportMenuInflater.java:196)
at android.support.v7.view.SupportMenuInflater.inflate(SupportMenuInflater.java:118)
at android.support.v7.widget.Toolbar.inflateMenu(Toolbar.java:899)
at com.helpshift.support.fragments.MainFragment.onViewCreated(MainFragment.java:134)
at com.helpshift.support.fragments.SupportFragment.onViewCreated(SupportFragment.java:119)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.RuntimeException: Failed to resolve attribute at index 0
at android.content.res.TypedArray.getDrawable(TypedArray.java:747)
at android.widget.ImageView.<init>(ImageView.java:156)
at android.widget.ImageView.<init>(ImageView.java:145)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:621)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:40)
at android.support.v4.view.MenuItemCompat.setActionView(MenuItemCompat.java:310)
at android.support.v7.view.SupportMenuInflater$MenuState.setItem(SupportMenuInflater.java:465)
at android.support.v7.view.SupportMenuInflater$MenuState.addItem(SupportMenuInflater.java:479)
at android.support.v7.view.SupportMenuInflater.parseMenu(SupportMenuInflater.java:196)
at android.support.v7.view.SupportMenuInflater.inflate(SupportMenuInflater.java:118)
at android.support.v7.widget.Toolbar.inflateMenu(Toolbar.java:899)
at com.helpshift.support.fragments.MainFragment.onViewCreated(MainFragment.java:134)
at com.helpshift.support.fragments.SupportFragment.onViewCreated(SupportFragment.java:119)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
任意のアイデアを、なぜこれが起こっていますか?
さらに、 -keep class android.support.v4を追加しました。 {*; } ** をproguardファイルに追加します。
解決方法を知りません。
コード:
final HashMap config = new HashMap();
config.put("toolbarId", R.id.toolbar);
try {
mDrawerLayout.postDelayed(new Runnable() {
@Override
public void run() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
try {
ft.replace(R.id.content_frame, Support.getFAQsFragment(MainActivity.this, config)).commitAllowingStateLoss();
} catch(IllegalStateException ex) {
// activity already destroyed
}
}
}, 300);
} catch (Exception ex) {
ex.printStackTrace();
return;
}
mDrawerLayout.closeDrawers();
あなたのコードはどこですか? –
私はコードoboveを追加しました。この行は、navdrawerの項目をクリックすると実行されます。 – b4um11
例外が発生しています。android.view.InflateException:バイナリXMLファイル行#10:ImageViewクラスを拡張しているときにエラーが発生しました。 –