How to fix crash on only Huawei devices in android.widget.SearchView - android

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.***.***/com.***.***.activities.SearchActivity}: android.view.InflateException: Binary XML file line #29: Binary XML file line #29: Error inflating class android.widget.SearchView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2451)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by android.view.InflateException: Binary XML file line #79: Binary XML file line #79: Error inflating class android.widget.SearchView$SearchAutoComplete
at android.view.LayoutInflater.inflate(LayoutInflater.java:558)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.widget.SearchView.inflateSearchView(SearchView.java:1847)
at android.widget.SearchView.(SearchView.java:268)
at android.widget.SearchView.(SearchView.java:259)
at android.widget.SearchView.(SearchView.java:255)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by android.view.InflateException: Binary XML file line #79: Error inflating class android.widget.SearchView$SearchAutoComplete
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.widget.SearchView.inflateSearchView(SearchView.java:1847)
at android.widget.SearchView.(SearchView.java:268)
at android.widget.SearchView.(SearchView.java:259)
at android.widget.SearchView.(SearchView.java:255)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.SearchView.isInActionMode()' on a null object reference
at android.widget.SearchView$SearchAutoComplete.enoughToFilter(SearchView.java:1801)
at android.widget.AutoCompleteTextView.doAfterTextChanged(AutoCompleteTextView.java:781)
at android.widget.AutoCompleteTextView$MyWatcher.afterTextChanged(AutoCompleteTextView.java:749)
at android.widget.TextView.sendAfterTextChanged(TextView.java:8232)
at android.widget.TextView.setText(TextView.java:4435)
at android.widget.TextView.setText(TextView.java:4283)
at android.widget.EditText.setText(EditText.java:84)
at android.widget.TextView.setText(TextView.java:4258)
at com.mikepenz.iconics.Iconics$IconicsBuilderView.build(Iconics.java:297)
at com.mikepenz.iconics.context.IconicsFactory.onViewCreatedInternal(IconicsFactory.java:50)
at com.mikepenz.iconics.context.IconicsFactory.onViewCreated(IconicsFactory.java:27)
at com.mikepenz.iconics.context.InternalLayoutInflater$PrivateWrapperFactory2.onCreateView(InternalLayoutInflater.java:245)
at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:773)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.widget.SearchView.inflateSearchView(SearchView.java:1847)
at android.widget.SearchView.(SearchView.java:268)
at android.widget.SearchView.(SearchView.java:259)
at android.widget.SearchView.(SearchView.java:255)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java:638)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:54)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:713)
at com.mikepenz.iconics.context.InternalLayoutInflater.onCreateView(InternalLayoutInflater.java:70)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:781)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:723)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:854)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:857)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:817)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.mikepenz.iconics.context.InternalLayoutInflater.inflate(InternalLayoutInflater.java:81)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.***.***.activities.SearchActivity.onCreate(SearchActivity.java:124)
at android.app.Activity.performCreate(Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
According to the log its happening in the oncreate of activity when trying to inflate the searchview. I am using 'android.widget.SearchView' instead of appcompat because I am animating it and can't get the appcompat version to animate properly.
I do not feel this is an animate issue though. I cannot figure out why its only happening on Huawei devices. I released this update last week and its already on 100k plus devices. According to Crashlytics its 100% Huawei and 81% Android 8, 15% Android 7 and 4% Android 6.
I have tried try/catches on the start activity, on create and few other places but nothing catches it. I can post code if needed but wanted to see if it was necessary.
Here is the searchview in the layout
<SearchView
android:id="#+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:iconifiedByDefault="false"/>
And this is initializing the searchview in oncreate
SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
if (searchManager != null) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
}
Setting setSearchableInfo is calling updateSearchAutoComplete() which is where the crash starts. But i have tried a try/catch there an still crashes.

Related

Android App is running on some devices but doesn't on another devices...How to solve that?

My app is perfectly running on Huawei Y9 prime which has android 10 and it crashes on Redmi Note 4 which has android 6. I made the project with Android 5...While I am installing the app on Redmi note 4 it isn't starting...A white screen comes for a very short time and the floats down...No error is shown in logcat, but this is shown in "Run" and that too when I click the app icon 3-4 times -
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.js11.a8minutesworkout, PID: 29896
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.js11.a8minutesworkout/com.js11.a8minutesworkout.MainActivity}: android.view.InflateException: Binary XML file line #25: Binary XML file line #25: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5438)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Caused by: android.view.InflateException: Binary XML file line #25: Binary XML file line #25: Error inflating class <unknown>
at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
at com.js11.a8minutesworkout.MainActivity.onCreate(MainActivity.kt:15)
at android.app.Activity.performCreate(Activity.java:6303)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
at android.app.ActivityThread.access$900(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5438) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 
Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:649)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:698)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:766)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:839)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802)
at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) 
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) 
at com.js11.a8minutesworkout.MainActivity.onCreate(MainActivity.kt:15) 
at android.app.Activity.performCreate(Activity.java:6303) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
at android.app.ActivityThread.access$900(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5438) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:623)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:698) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:766) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:519) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) 
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) 
at com.js11.a8minutesworkout.MainActivity.onCreate(MainActivity.kt:15) 
at android.app.Activity.performCreate(Activity.java:6303) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
at android.app.ActivityThread.access$900(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5438) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628) 
Caused by: android.content.res.Resources$NotFoundException: Resource "com.js11.a8minutesworkout:drawable/item_color_accent_border_ripple_background" (7f07008c) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f07008c a=-1 r=0x7f07008c}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2646)
at android.content.res.Resources.loadDrawable(Resources.java:2580)
at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:387)
at android.content.res.TypedArray.getDrawable(TypedArray.java:872)
at android.view.View.<init>(View.java:3955)
at android.view.ViewGroup.<init>(ViewGroup.java:574)
at android.widget.LinearLayout.<init>(LinearLayout.java:203)
at android.widget.LinearLayout.<init>(LinearLayout.java:199)
at android.widget.LinearLayout.<init>(LinearLayout.java:195)
at java.lang.reflect.Constructor.newInstance(Native Method) 
at android.view.LayoutInflater.createView(LayoutInflater.java:623) 
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:698) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:766) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:708) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:839) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:842) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:802) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:519) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696) 
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170) 
at com.js11.a8minutesworkout.MainActivity.onCreate(MainActivity.kt:15) 
at android.app.Activity.performCreate(Activity.java:6303) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
at android.app.ActivityThread.access$900(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5438) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
MainActivity code -
class MainActivity : AppCompatActivity() {
#RequiresApi(Build.VERSION_CODES.LOLLIPOP)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.navigationBarColor = resources.getColor(R.color.backgroundColor)
llStart.setOnClickListener {
val intent = Intent(this, ExerciseActivity::class.java)
startActivity(intent)
}
llBMI.setOnClickListener{
val intent = Intent(this, BMIActivity::class.java)
startActivity(intent)
}
llHistory.setOnClickListener {
val intent = Intent(this, HistoryActivity::class.java)
startActivity(intent)
}
}
}
drawable/item_color_accent_border_ripple_background -
<?xml version="1.0" encoding="utf-8"?>
<item android:id="#android:id/mask">
<shape android:shape="oval">
<solid android:color="#000000" /><!--ye color jahe jo bhi rkho isse frk nh pdne wala-->
</shape>
</item>
<item android:drawable="#drawable/item_circular_color_accent_border" />
I am new to android developing and I am very frustrated with this problem..
PLEASE HELP
maybe you can change android sdk version.
in androidmanifest.xml file.
targetsdkversion and minsdkversion first check.
llStart.setOnClickListener {
val intent = Intent(MainActivity.this, ExerciseActivity::class.java)
startActivity(intent)
}
llBMI.setOnClickListener{
val intent = Intent(MainActivity.this, BMIActivity::class.java)
startActivity(intent)
}
llHistory.setOnClickListener {
val intent = Intent(MainActivity.this, HistoryActivity::class.java)
startActivity(intent)
}
only this will point to the parent function that is onclicklistener, so you want to use activity's context then you should use className.this

Getting InflateException for TextView

I am getting InflateException for TextView. I don't know how to handle it, please help me.
This is the Logcat,
Process: com.aryagami.locationservices, PID: 25870
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aryagami.locationservices/com.aryagami.locationservices.activities.StartScreen}: android.view.InflateException: Binary XML file line #64: Error inflating class TextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1285)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5233)
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:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
Caused by: android.view.InflateException: Binary XML file line #64: Error inflating class TextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.aryagami.util.ActionbarSetup.setupActionBar(ActionbarSetup.java:28)
at com.aryagami.locationservices.fragments.NavigationDrawerFragment.setUp(NavigationDrawerFragment.java:519)
at com.aryagami.locationservices.activities.StartScreen.onCreate(StartScreen.java:89)
at android.app.Activity.performCreate(Activity.java:6001)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368) 
at android.app.ActivityThread.access$800(ActivityThread.java:144) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1285) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5233) 
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:898) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) 
Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:572)
at android.widget.TextView.<init>(TextView.java:1004)
at android.widget.TextView.<init>(TextView.java:634)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:59)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:55)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
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.rInflate(LayoutInflater.java:809) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at com.aryagami.util.ActionbarSetup.setupActionBar(ActionbarSetup.java:28) 
at com.aryagami.locationservices.fragments.NavigationDrawerFragment.setUp(NavigationDrawerFragment.java:519) 
at com.aryagami.locationservices.activities.StartScreen.onCreate(StartScreen.java:89) 
at android.app.Activity.performCreate(Activity.java:6001) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2368) 
at android.app.ActivityThread.access$800(ActivityThread.java:144) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1285) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5233) 
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:898) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) 

Framelayout is not allowing add resource image as background

Fragment xml file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="xxx.boson.com.xxxldigital.fragments.MenuFragment"
android:alpha="0.9"
android:background="#drawable/app1">
<!-- some simple components -->
</FrameLayout>
Without background is running with any problem, but with the background attribute:
FATAL EXCEPTION: main
Process: sanmiguel.boson.com.sanmigueldigital, PID: 11219
java.lang.RuntimeException: Unable to start activity
ComponentInfo{sanmiguel.boson.com.sanmigueldigital/sanmiguel.boson.com.sanmigueldigital.MainActivity}:
android.view.InflateException: Binary XML file line #1: Binary XML
file line #1: Error inflating class
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3254)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
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: android.view.InflateException: Binary XML file line #1:
Binary XML file line #1: Error inflating class
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at
sanmiguel.boson.com.sanmigueldigital.fragments.MenuFragment.onCreateView(MenuFragment.java:68)
at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at
android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
at
android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:601)
at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1265)
at android.app.Activity.performStart(Activity.java:6915)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3217)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
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: android.view.InflateException: Binary XML file line #1:
Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:657)
at
com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at
sanmiguel.boson.com.sanmigueldigital.fragments.MenuFragment.onCreateView(MenuFragment.java:68) 
at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
at
android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
at
android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:601) 
at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1265) 
at android.app.Activity.performStart(Activity.java:6915) 
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3217) 
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
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.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:631)
at
com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706) 
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774) 
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at
sanmiguel.boson.com.sanmigueldigital.fragments.MenuFragment.onCreateView(MenuFragment.java:68) 
at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
at
android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
at
android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:601) 
at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1265) 
at android.app.Activity.performStart(Activity.java:6915) 
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3217) 
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
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.OutOfMemoryError: Failed to allocate a 132710412
byte allocation with 16777216 free bytes and 117MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:856)
at
android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:675)
at
android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:2228)
at
android.content.res.Resources.loadDrawableForCookie(Resources.java:4211)
at android.content.res.Resources.loadDrawable(Resources.java:4085)
at android.content.res.Resources.loadDrawable(Resources.java:3935)
at android.content.res.TypedArray.getDrawable(TypedArray.java:886)
at android.view.View.(View.java:4225)
at android.view.ViewGroup.(ViewGroup.java:589)
at android.widget.FrameLayout.(FrameLayout.java:97)
at android.widget.FrameLayout.(FrameLayout.java:92)
at android.widget.FrameLayout.(FrameLayout.java:88)
at java.lang.reflect.Constructor.newInstance(Native Method) 
at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
at
com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:706) 
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:774) 
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at
sanmiguel.boson.com.sanmigueldigital.fragments.MenuFragment.onCreateView(MenuFragment.java:68) 
at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
at
android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339) 
at
android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:601) 
at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1265) 
at android.app.Activity.performStart(Activity.java:6915) 
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3217) 
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350) 
at android.app.ActivityThread.access$1100(ActivityThread.java:222) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:158) 
at android.app.ActivityThread.main(ActivityThread.java:7229) 
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)
Problem with background image. Its size is too big.
java.lang.OutOfMemoryError: Failed to allocate a 132710412 byte allocation with 16777216 free bytes and 117MB until OOM at dalvik.system
remove this line
android:background="#drawable/app1"
set id for your layout
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/mainLayout"
android:layout_width="match_parent"
on java class file
FrameLayout mainLayout = (FrameLayout) findViewById(R.id.mainLayout);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mainLayout.setBackground(getScaledDrawable(R.drawable.app1));
} else {
mainLayout.setBackgroundDrawable(getScaledDrawable(R.drawable.app1));
}
}
//scale image here
private Drawable getScaledDrawable(int resourceID) {
}

Weird error: android.view.InflateException: Binary XML file

The app builds properly without any errors but crashes every time I try to run it. Here is the trace:
FATAL EXCEPTION: main
Process: com.thevarunshah.swotanalysistool, PID: 18808
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thevarunshah.swotanalysistool/com.thevarunshah.swotanalysistool.HomeScreen}: android.view.InflateException: Binary XML file line #38: Error inflating class com.android.internal.widget.ActionBarView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2436)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
at android.app.ActivityThread.access$900(ActivityThread.java:170)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5635)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class com.android.internal.widget.ActionBarView
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3336)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3399)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:348)
at android.app.Activity.setContentView(Activity.java:2062)
at com.thevarunshah.swotanalysistool.HomeScreen.onCreate(HomeScreen.java:26)
at android.app.Activity.performCreate(Activity.java:5585)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3336) 
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3399) 
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:348) 
at android.app.Activity.setContentView(Activity.java:2062) 
at com.thevarunshah.swotanalysistool.HomeScreen.onCreate(HomeScreen.java:26) 
at android.app.Activity.performCreate(Activity.java:5585) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class android.widget.TextView
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.android.internal.widget.ActionBarView.initTitle(ActionBarView.java:1211)
at com.android.internal.widget.ActionBarView.setDisplayOptions(ActionBarView.java:993)
at com.android.internal.widget.ActionBarView.<init>(ActionBarView.java:399)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3336) 
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3399) 
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:348) 
at android.app.Activity.setContentView(Activity.java:2062) 
at com.thevarunshah.swotanalysistool.HomeScreen.onCreate(HomeScreen.java:26) 
at android.app.Activity.performCreate(Activity.java:5585) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at com.android.internal.widget.ActionBarView.initTitle(ActionBarView.java:1211) 
at com.android.internal.widget.ActionBarView.setDisplayOptions(ActionBarView.java:993) 
at com.android.internal.widget.ActionBarView.<init>(ActionBarView.java:399) 
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:769) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3336) 
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3399) 
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:348) 
at android.app.Activity.setContentView(Activity.java:2062) 
at com.thevarunshah.swotanalysistool.HomeScreen.onCreate(HomeScreen.java:26) 
at android.app.Activity.performCreate(Activity.java:5585) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
at android.content.res.TypedArray.getColor(TypedArray.java:327)
at android.widget.TextView.<init>(TextView.java:1094)
at android.widget.Text
Not sure what is causing this error - any help would be appreciated!
Here a few things that could help:
HomeScreen.java:26: setContentView(R.layout.home_screen);
home_screen.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:background="#color/homeBG"
android:gravity="center"
tools:context="com.thevarunshah.swotanalysistool.HomeScreen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:orientation="vertical" >
<ImageView
android:id="#+id/swot_logo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0.25"
android:src="#drawable/swot" />
</LinearLayout>
</RelativeLayout>
HomeScreen.java:
package com.thevarunshah.swotanalysistool;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.thevarunshah.swotanalysistool.backend.Database;
import com.thevarunshah.swotanalysistool.backend.SWOTObject;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.HashMap;
public class HomeScreen extends Activity {
private Context ctx;
// Splash screen timer
private static int SPLASH_TIME_OUT = 1500;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
ctx = getApplicationContext();
Database.setSWOTs(new HashMap<Integer, SWOTObject>());
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = openFileInput("swot_backup.ser");
ois = new ObjectInputStream(fis);
Database.setId(ois.readInt());
Database.setSWOTs((HashMap<Integer, SWOTObject>)ois.readObject());
} catch (Exception e) {
e.printStackTrace();
} finally{
try{
if(ois != null) ois.close();
if(fis != null) fis.close();
} catch(Exception e){
e.printStackTrace();
}
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo / company
*/
#Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(ctx, SavedSWOTsScreen.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
}
Looking at your error trace, there's a problem with some color not being properly defined:
java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
So you have to look for a TextView you're inflating (inside an adapter?):
Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class android.widget.TextView
Without more code / xml these are just guesses.
Also, this could be a problem with your App's theme / styles, as the ActionBar complains when created:
Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class com.android.internal.widget.ActionBarView
Is this color properly defined? Post here:
android:background="#color/homeBG"

Android - Binary XML file line #11: Error inflating class <unknown>

Not sure why its giving me this error. The XML is super simple and I just have a class which assigns the objects.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/mapview"
android:name="com.testapp.app.custom.CustomMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight='4' />
<ImageView
android:id="#+id/map_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/nav_location_start"
android:layout_marginBottom="25dp"
android:layout_gravity="center"
android:scaleType="center"/>
</FrameLayout>
Class
public class MapPinView extends FrameLayout {
public SupportMapFragment getMapView() {
return mapView;
}
public void setMapView(SupportMapFragment mapView) {
this.mapView = mapView;
}
SupportMapFragment mapView;
private ImageView mapPin;
public MapPinView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View linearLayout = layoutInflater.inflate(R.layout.mapview_pin_layout, this);
this.mapPin = (ImageView) linearLayout.findViewById(R.id.map_pin);
}
public ImageView getMapPin() {
return mapPin;
}
public void setMapPin(ImageView mapPin) {
this.mapPin = mapPin;
}
}
Its crashing on Line 11 of the xml which is the imageview. From other posts, most people have been getting out of memory errors but I haven't seen that error yet. Any help is appreciated.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testapp.app/com.testapp.app.menu.MainDrawerActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2661)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.testapp.app.menu.main_map.MapViewFragment.onCreate(MapViewFragment.java:821)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1766)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:917)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
at android.app.Activity.performStart(Activity.java:6258)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2624)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.testapp.app.menu.main_map.MapViewFragment.onCreate(MapViewFragment.java:821)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1766)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:917)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
at android.app.Activity.performStart(Activity.java:6258)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2624)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by android.view.InflateException: Binary XML file line #5: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:770)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.testapp.app.custom.MapPinView.<init>(MapPinView.java:36)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.testapp.app.menu.main_map.MapViewFragment.onCreate(MapViewFragment.java:821)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1766)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:917)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
at android.app.Activity.performStart(Activity.java:6258)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2624)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by java.lang.IllegalArgumentException: Binary XML file line #5: Duplicate id 0x7f0b0124, tag null, or parent id 0x0 with another fragment for com.testapp.app.custom.CustomMap
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2175)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
at android.support.v7.app.AppCompatDelegateImplV7.callActivityOnCreateView(AppCompatDelegateImplV7.java:838)
at android.support.v7.app.AppCompatDelegateImplV11.callActivityOnCreateView(AppCompatDelegateImplV11.java:34)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:826)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:732)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.testapp.app.custom.MapPinView.<init>(MapPinView.java:36)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.testapp.app.menu.main_map.MapViewFragment.onCreate(MapViewFragment.java:821)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1766)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:917)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1234)
at android.app.Activity.performStart(Activity.java:6258)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2624)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
You have done something not acceptable in fragment handling. Take a look at this documentation.
Note: You cannot inflate a layout into a fragment when that layout
includes a <fragment>. Nested fragments are only supported when added
to a fragment dynamically.
You should instead add fragments programmatically by calling getChildFragmentManager()
Here is an example from the same documentation:
Fragment videoFragment = new VideoPlayerFragment();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.video_fragment, videoFragment).commit();

Categories

Resources