私は、stackoverflowに関する同様の質問がたくさんあることを知っています。 しかし、これらのどれも私の問題を解決しません。Android - テキストを拡大表示する際のエラー
テーマ設定やリソースが見つかりません。 そして、私はこのレイアウトで大きな画像を読み込まなかった(すべての背景はdrawable xmlからである)。 すべての属性は、名前空間宣言を含む正確な値を持ちます。 この例外をランダムにスローします。 アンドロイドのバグのようです。
Nexus 5X、Nexus 6P、HTC_A9u、ASUS_Z012などで発生します。 API 25、サポートライブラリ25.0.1、ビルドツール25.0.2を使用しています。
それは私が25
20と同様のノードがScrollView
とレイアウトであり、APIを使用するように変更した後に、この例外を報告して開始します。 Fragment
はこのレイアウトを保持しています。 フラグメントトランザクションで初期化してからDrawerLayout
に入れます。
レイアウトノード:
<ScrollView
android:id="@+id/mainMenuScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
...
<RelativeLayout
android:id="@+id/aboutHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:paddingTop="7dp"
android:paddingBottom="7dp"
android:paddingStart="10dp"
android:paddingEnd="5dp"
android:clickable="true"
android:background="?theme.mainMenuItemBackground"
android:layout_below="@+id/otherHolder">
<TextView
android:id="@+id/aboutCapital"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:background="@drawable/my_background"
android:gravity="center"
android:textSize="14sp"
android:textColor="?theme.titleColor"
android:text="A"/>
<TextView
android:id="@+id/aboutName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_toEndOf="@+id/aboutCapital"
android:textStyle="bold"
android:textSize="@dimen/menu_item_title"
android:textColor="?theme.titleColor"
android:text="About"/>
</RelativeLayout>
...
</RelativeLayout>
</ScrollView>
またScrollView
または<unknown>
のようなものの上に起こります。
エラーログ(TextView
):
Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.LauncherActivity}: android.view.InflateException: Binary XML file line #813: Binary XML file line #813: Error inflating class TextView
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2665)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2726)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1477)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6119)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
Caused by android.view.InflateException: Binary XML file line #813: Binary XML file line #813: Error inflating class TextView
Caused by android.view.InflateException: Binary XML file line #813: Error inflating class TextView
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
android.content.res.AssetManager.getPooledStringForCookie (AssetManager.java:306)
android.content.res.TypedArray.loadStringValueAt (TypedArray.java:1217)
android.content.res.TypedArray.getValueAt (TypedArray.java:1203)
android.content.res.TypedArray.getColorStateList (TypedArray.java:526)
android.widget.TextView.<init> (TextView.java:1080)
android.widget.TextView.<init> (TextView.java:704)
android.support.v7.widget.AppCompatTextView.<init> (AppCompatTextView.java:62)
android.support.v7.widget.AppCompatTextView.<init> (AppCompatTextView.java:58)
android.support.v7.app.AppCompatViewInflater.createView (AppCompatViewInflater.java:103)
android.support.v7.app.AppCompatDelegateImplV9.createView (AppCompatDelegateImplV9.java:1017)
android.support.v7.app.AppCompatDelegateImplV9.onCreateView (AppCompatDelegateImplV9.java:1076)
android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView (LayoutInflaterCompatHC.java:44)
android.view.LayoutInflater$FactoryMerger.onCreateView (LayoutInflater.java:192)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:769)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:727)
android.view.LayoutInflater.rInflate (LayoutInflater.java:858)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.inflate (LayoutInflater.java:518)
android.view.LayoutInflater.inflate (LayoutInflater.java:426)
com.example.myapp.MainMenuFragment.onCreateView (MainMenuFragment.java:306)
android.support.v4.app.Fragment.performCreateView (Fragment.java:2087)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1113)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1295)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1277)
android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManagerImpl.java:2154)
android.support.v4.app.FragmentController.dispatchActivityCreated (FragmentController.java:201)
android.support.v4.app.FragmentActivity.onStart (FragmentActivity.java:603)
android.support.v7.app.AppCompatActivity.onStart (AppCompatActivity.java:181)
com.example.myapp.LauncherActivity.onStart (LauncherActivity.java:2193)
android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1248)
android.app.Activity.performStart (Activity.java:6696)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2628)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2726)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1477)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6119)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
エラーログ(<unknown>
)
Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.LauncherActivity}: android.view.InflateException: Binary XML file line #1051: Binary XML file line #1051: Error inflating class <unknown>
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2666)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2727)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1478)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6121)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:876)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:766)
Caused by android.view.InflateException: Binary XML file line #1051: Binary XML file line #1051: Error inflating class <unknown>
Caused by android.view.InflateException: Binary XML file line #1051: Error inflating class <unknown>
Caused by java.lang.reflect.InvocationTargetException:
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:430)
android.view.LayoutInflater.createView (LayoutInflater.java:645)
com.android.internal.policy.PhoneLayoutInflater.onCreateView (PhoneLayoutInflater.java:58)
android.view.LayoutInflater.onCreateView (LayoutInflater.java:717)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:785)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:727)
android.view.LayoutInflater.rInflate (LayoutInflater.java:858)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.inflate (LayoutInflater.java:518)
android.view.LayoutInflater.inflate (LayoutInflater.java:426)
com.example.myapp.MainMenuFragment.onCreateView (MainMenuFragment.java:306)
android.support.v4.app.Fragment.performCreateView (Fragment.java:2087)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1113)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1295)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1277)
android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManagerImpl.java:2154)
android.support.v4.app.FragmentController.dispatchActivityCreated (FragmentController.java:201)
android.support.v4.app.FragmentActivity.onStart (FragmentActivity.java:603)
android.support.v7.app.AppCompatActivity.onStart (AppCompatActivity.java:181)
com.example.myapp.LauncherActivity.onStart (LauncherActivity.java:2193)
android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1248)
android.app.Activity.performStart (Activity.java:6699)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2629)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2727)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1478)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6121)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:876)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:766)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
android.content.res.AssetManager.getPooledStringForCookie (AssetManager.java:306)
android.content.res.TypedArray.loadStringValueAt (TypedArray.java:1217)
android.content.res.TypedArray.getValueAt (TypedArray.java:1203)
android.content.res.TypedArray.getDrawable (TypedArray.java:923)
android.view.View.<init> (View.java:4202)
android.view.ViewGroup.<init> (ViewGroup.java:579)
android.widget.RelativeLayout.<init> (RelativeLayout.java:248)
android.widget.RelativeLayout.<init> (RelativeLayout.java:244)
android.widget.RelativeLayout.<init> (RelativeLayout.java:240)
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:430)
android.view.LayoutInflater.createView (LayoutInflater.java:645)
com.android.internal.policy.PhoneLayoutInflater.onCreateView (PhoneLayoutInflater.java:58)
android.view.LayoutInflater.onCreateView (LayoutInflater.java:717)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:785)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:727)
android.view.LayoutInflater.rInflate (LayoutInflater.java:858)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.rInflate (LayoutInflater.java:861)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.inflate (LayoutInflater.java:518)
android.view.LayoutInflater.inflate (LayoutInflater.java:426)
com.example.myapp.MainMenuFragment.onCreateView (MainMenuFragment.java:306)
android.support.v4.app.Fragment.performCreateView (Fragment.java:2087)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1113)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1295)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1277)
android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManagerImpl.java:2154)
android.support.v4.app.FragmentController.dispatchActivityCreated (FragmentController.java:201)
android.support.v4.app.FragmentActivity.onStart (FragmentActivity.java:603)
android.support.v7.app.AppCompatActivity.onStart (AppCompatActivity.java:181)
com.example.myapp.LauncherActivity.onStart (LauncherActivity.java:2193)
android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1248)
android.app.Activity.performStart (Activity.java:6699)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2629)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2727)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1478)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6121)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:876)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:766)
エラーログ(ScrollView
):
Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.LauncherActivity}: android.view.InflateException: Binary XML file line #13: Binary XML file line #13: Error inflating class android.widget.ScrollView
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2665)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2726)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1477)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6119)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
Caused by android.view.InflateException: Binary XML file line #13: Binary XML file line #13: Error inflating class android.widget.ScrollView
Caused by android.view.InflateException: Binary XML file line #13: Error inflating class android.widget.ScrollView
Caused by java.lang.reflect.InvocationTargetException:
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:430)
android.view.LayoutInflater.createView (LayoutInflater.java:645)
com.android.internal.policy.PhoneLayoutInflater.onCreateView (PhoneLayoutInflater.java:58)
android.view.LayoutInflater.onCreateView (LayoutInflater.java:717)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:785)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:727)
android.view.LayoutInflater.rInflate (LayoutInflater.java:858)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.inflate (LayoutInflater.java:518)
android.view.LayoutInflater.inflate (LayoutInflater.java:426)
com.example.myapp.MainMenuFragment.onCreateView (MainMenuFragment.java:288)
android.support.v4.app.Fragment.performCreateView (Fragment.java:2087)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1113)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1295)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1277)
android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManagerImpl.java:2154)
android.support.v4.app.FragmentController.dispatchActivityCreated (FragmentController.java:201)
android.support.v4.app.FragmentActivity.onStart (FragmentActivity.java:603)
android.support.v7.app.AppCompatActivity.onStart (AppCompatActivity.java:181)
com.example.myapp.LauncherActivity.onStart (LauncherActivity.java:2196)
android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1248)
android.app.Activity.performStart (Activity.java:6696)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2628)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2726)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1477)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6119)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
android.content.res.AssetManager.getPooledStringForCookie (AssetManager.java:306)
android.content.res.TypedArray.loadStringValueAt (TypedArray.java:1217)
android.content.res.TypedArray.getValueAt (TypedArray.java:1203)
android.content.res.TypedArray.getDrawable (TypedArray.java:923)
android.view.View.initializeScrollbarsInternal (View.java:5133)
android.view.View.<init> (View.java:4660)
android.view.ViewGroup.<init> (ViewGroup.java:579)
android.widget.FrameLayout.<init> (FrameLayout.java:92)
android.widget.ScrollView.<init> (ScrollView.java:180)
android.widget.ScrollView.<init> (ScrollView.java:176)
android.widget.ScrollView.<init> (ScrollView.java:172)
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:430)
android.view.LayoutInflater.createView (LayoutInflater.java:645)
com.android.internal.policy.PhoneLayoutInflater.onCreateView (PhoneLayoutInflater.java:58)
android.view.LayoutInflater.onCreateView (LayoutInflater.java:717)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:785)
android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:727)
android.view.LayoutInflater.rInflate (LayoutInflater.java:858)
android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:821)
android.view.LayoutInflater.inflate (LayoutInflater.java:518)
android.view.LayoutInflater.inflate (LayoutInflater.java:426)
com.example.myapp.MainMenuFragment.onCreateView (MainMenuFragment.java:288)
android.support.v4.app.Fragment.performCreateView (Fragment.java:2087)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1113)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1295)
android.support.v4.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1277)
android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManagerImpl.java:2154)
android.support.v4.app.FragmentController.dispatchActivityCreated (FragmentController.java:201)
android.support.v4.app.FragmentActivity.onStart (FragmentActivity.java:603)
android.support.v7.app.AppCompatActivity.onStart (AppCompatActivity.java:181)
com.example.myapp.LauncherActivity.onStart (LauncherActivity.java:2196)
android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1248)
android.app.Activity.performStart (Activity.java:6696)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2628)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2726)
android.app.ActivityThread.-wrap12 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1477)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6119)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
同じ問題に変更する必要があります。それは私のレイアウトの原因となっているランダムなTextViewです。違うことも特別なこともありません。あなたは回避策を見つけましたか? – ono
いいえ、私はしていません。しかし、この文書のhttps://developer.android.com/topic/performance/launch-timeによると、 'setTheme(R.style.AppTheme);を' super.onCreate(savedInstanceState);の前に置いた方が良いです。 html。 –