How do I resolve this InflateException - after clicking a button? - android

This is the error that occurs when I click a button:
09-15 01:09:08.934 32386-32386/com.example.ajalandoni.chemistryworld E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ajalandoni.chemistryworld, PID: 32386
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ajalandoni.chemistryworld/sarveshchavan777.triviaquiz.MainGameActivity}: android.view.InflateException: Binary XML file line #105: Binary XML file line #105: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2781)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1592)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6518)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #105: Binary XML file line #105: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #105: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at sarveshchavan777.triviaquiz.MainGameActivity.onCreate(MainGameActivity.java:36)
at android.app.Activity.performCreate(Activity.java:7013)
at android.app.Activity.performCreate(Activity.java:7004)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2734)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1592)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6518)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
at android.content.res.TypedArray.getColor(TypedArray.java:473)
at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
at info.hoang8f.widget.FButton.<init>(FButton.java:52)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at sarveshchavan777.triviaquiz.MainGameActivity.onCreate(MainGameActivity.java:36) 
at android.app.Activity.performCreate(Activity.java:7013) 
at android.app.Activity.performCreate(Activity.java:7004) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2734) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1592) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6518) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
This my activity_game_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fbutton="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/backgroundColor"
android:orientation="vertical"
tools:context="sarveshchavan777.triviaquiz.MainGameActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/lightGreen"
android:minHeight="?actionBarSize">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp">
<ImageView
android:id="#+id/coinImage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="#drawable/coin" />
<TextView
android:id="#+id/coinText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=""
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:gravity="center"
android:textSize="20sp"
android:layout_toRightOf="#id/coinImage"
android:layout_toEndOf="#id/coinImage" />
<TextView
android:id="#+id/triviaQuizText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="#string/app_name"
android:textColor="#color/white"
android:textSize="25sp"
android:layout_toLeftOf="#+id/timeText"
android:layout_toRightOf="#+id/coinText"
android:layout_toStartOf="#+id/timeText"
android:layout_toEndOf="#+id/coinText" />
<TextView
android:id="#+id/timeText"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingLeft="10dp"
android:gravity="center"
android:paddingRight="10dp"
android:text="#string/time"
android:textSize="20sp" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<View
android:layout_width="match_parent"
android:layout_height="10dp"></View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".5"
android:background="#color/white"
android:orientation="vertical">
<TextView
android:id="#+id/triviaQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center"
android:text="#string/question"
android:textColor="#color/grey"
android:textSize="18sp" />
<TextView
android:id="#+id/resultText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#color/green"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<info.hoang8f.widget.FButton
android:id="#+id/buttonA"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="buttonA"
android:text=""
android:textColor="#color/grey"
fbutton:buttonColor="#color/white"
fbutton:cornerRadius="10dp"
fbutton:shadowColor="#color/grey" />
<info.hoang8f.widget.FButton
android:id="#+id/buttonB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="buttonB"
android:text=""
android:textColor="#color/grey"
fbutton:buttonColor="#color/white"
fbutton:cornerRadius="10dp"
fbutton:shadowColor="#color/grey" />
<info.hoang8f.widget.FButton
android:id="#+id/buttonC"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="buttonC"
android:text=""
android:textColor="#color/grey"
fbutton:buttonColor="#color/white"
fbutton:cornerRadius="10dp"
fbutton:shadowColor="#color/grey" />
<info.hoang8f.widget.FButton
android:id="#+id/buttonD"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="buttonD"
android:text=""
android:textColor="#color/grey"
fbutton:buttonColor="#color/white"
fbutton:cornerRadius="10dp"
fbutton:shadowColor="#color/grey" />
</LinearLayout>
</LinearLayout>
What could be the possible cause of this problem?
I already tried this solution, but this doesn't work for me.

Change your dependency with this
compile 'com.github.jd-alexander:android-flat-button:v1.1'
use this library it will fix your problem. The library you are using has some issue check this library.
Also add maven { url "https://jitpack.io" } in build.gradle (Project Level) in repositories block your code will look like this :
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}

Well I think the problem is with the android gradle plugin version. Try changing it to 2.3.3 in File -> Project Structure -> Project.

Related

Error inflating class com.google.android.exoplayer2.ui.StyledPlayerView

I was using SimpleExoPlayerView till now and now updated my Exoplayer library to latest and it is removed and has been asked to replace with PlayerView But it is also deprecated and has been asked to implement StyledPlayerView But after implementing the StyledPlayerView I am getting a crash Error inflating class com.google.android.exoplayer2.ui.StyledPlayerView
app level build.gradle:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
dependencies {
...
implementation 'com.google.android.exoplayer:exoplayer:2.17.1'
...
}
xml File:
<LinearLayout
android:id="#+id/ll_exoplayer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="#+id/done_tv"
app:layout_constraintDimensionRatio="9:16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.509"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/constraintLayout2">
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="#+id/exoplayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="visible"
app:controller_layout_id="#layout/exo_playback_control_view" />
</LinearLayout>
Crash Log:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.package/com.app.package.login.AppTutorialActivity}: android.view.InflateException: Binary XML file line #113 in com.app.package:layout/activity_app_tutorial: Binary XML file line #113 in com.app.package:layout/activity_app_tutorial: Error inflating class com.google.android.exoplayer2.ui.StyledPlayerView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: android.view.InflateException: Binary XML file line #113 in com.app.package:layout/activity_app_tutorial: Binary XML file line #113 in com.app.package:layout/activity_app_tutorial: Error inflating class com.google.android.exoplayer2.ui.StyledPlayerView
Caused by: android.view.InflateException: Binary XML file line #113 in com.app.package:layout/activity_app_tutorial: Error inflating class com.google.android.exoplayer2.ui.StyledPlayerView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
at androidx.databinding.ViewDataBinding.inflateInternal(ViewDataBinding.java:1409)
at com.app.package.databinding.ActivityAppTutorialBinding.inflate(ActivityAppTutorialBinding.java:99)
at com.app.package.databinding.ActivityAppTutorialBinding.inflate(ActivityAppTutorialBinding.java:85)
at com.app.package.login.AppTutorialActivity$mAppTutorialBinding$2.invoke(AppTutorialActivity.kt:59)
at com.app.package.login.AppTutorialActivity$mAppTutorialBinding$2.invoke(AppTutorialActivity.kt:59)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.app.package.login.AppTutorialActivity.getMAppTutorialBinding(AppTutorialActivity.kt:59)
at com.app.package.login.AppTutorialActivity.onCreate(AppTutorialActivity.kt:63)
at android.app.Activity.performCreate(Activity.java:8006)
at android.app.Activity.performCreate(Activity.java:7990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3584)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
2022-04-08 10:59:06.604 32468-32468/com.app.package E/AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: android.view.InflateException: Binary XML file line #16 in com.app.package:layout/exo_styled_settings_list: Binary XML file line #16 in com.app.package:layout/exo_styled_settings_list: Error inflating class androidx.recyclerview.widget.RecyclerView
Caused by: android.view.InflateException: Binary XML file line #16 in com.app.package:layout/exo_styled_settings_list: Error inflating class androidx.recyclerview.widget.RecyclerView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.inflate(LayoutInflater.java:657)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.google.android.exoplayer2.ui.StyledPlayerControlView.<init>(StyledPlayerControlView.java:550)
at com.google.android.exoplayer2.ui.StyledPlayerView.<init>(StyledPlayerView.java:418)
at com.google.android.exoplayer2.ui.StyledPlayerView.<init>(StyledPlayerView.java:234)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:852)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:126)
at androidx.databinding.ViewDataBinding.inflateInternal(ViewDataBinding.java:1409)
at com.app.package.databinding.ActivityAppTutorialBinding.inflate(ActivityAppTutorialBinding.java:99)
at com.app.package.databinding.ActivityAppTutorialBinding.inflate(ActivityAppTutorialBinding.java:85)
at com.app.package.login.AppTutorialActivity$mAppTutorialBinding$2.invoke(AppTutorialActivity.kt:59)
at com.app.package.login.AppTutorialActivity$mAppTutorialBinding$2.invoke(AppTutorialActivity.kt:59)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.app.package.login.AppTutorialActivity.getMAppTutorialBinding(AppTutorialActivity.kt:59)
at com.app.package.login.AppTutorialActivity.onCreate(AppTutorialActivity.kt:63)
at android.app.Activity.performCreate(Activity.java:8006)
at android.app.Activity.performCreate(Activity.java:7990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
2022-04-08 10:59:06.604 32468-32468/com.app.package E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3584)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8010)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: java.lang.IllegalArgumentException: Providing a LayoutTransition into RecyclerView is not supported. Please use setItemAnimator() instead for animating changes to the items in this RecyclerView
at androidx.recyclerview.widget.RecyclerView.setLayoutTransition(RecyclerView.java:2442)
at android.view.ViewGroup.initFromAttributes(ViewGroup.java:785)
at android.view.ViewGroup.<init>(ViewGroup.java:711)
at android.view.ViewGroup.<init>(ViewGroup.java:704)
at androidx.recyclerview.widget.RecyclerView.<init>(RecyclerView.java:689)
at androidx.recyclerview.widget.RecyclerView.<init>(RecyclerView.java:685)
... 46 more
exo_playback_control_view layout file:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#A6000000"
android:layoutDirection="ltr"
android:orientation="vertical">
<FrameLayout
android:id="#+id/exo_fullscreen_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/exo_fullscreen_icon"
android:layout_width="#dimen/dp_25"
android:layout_height="#dimen/dp_25"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="#drawable/ic_fullscreen_expand" />
</FrameLayout>
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="left"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/exo_fullscreen_button"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent">
<ImageButton
android:id="#id/exo_play"
style="#style/ExoMediaButton.Play"
android:layout_width="#dimen/dp_40"
android:layout_height="#dimen/dp_40" />
<ImageButton
android:id="#id/exo_pause"
style="#style/ExoMediaButton.Pause"
android:layout_width="#dimen/dp_40"
android:layout_height="#dimen/dp_40" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:includeFontPadding="false"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text=""
android:textColor="#FFBEBEBE"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="#id/exo_progress"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/exo_duration"
app:layout_constraintStart_toEndOf="#+id/exo_position"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:includeFontPadding="false"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text=""
android:textColor="#FFBEBEBE"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
One more thing to add. This code is in an activity. I mentioned it's an activity because I have added the same code in a fragment and it is working fine.

android.view.InflateException: Binary XML file line #133: Error inflating class <unknown>

I'm trying to start this fragment but I'm taking the error below. From what I read, this seems to have a possible large image, but I didn't identify it, after all in this part it calls maps. If anyone has experienced this error, I am grateful for the contribution!`
2021-06-14 12:42:10.327 26833-26833/com.helpcars.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.helpcars.app, PID: 26833
android.view.InflateException: Binary XML file line #133: Binary XML file line #133: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #133: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.helpcars.app.Fragments.HomeFragment.onCreateView(HomeFragment.java:308)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.content.res.Resources$NotFoundException: Drawable android:color/primary_text_dark with resource ID #0x1060001
Caused by: android.content.res.Resources$NotFoundException: File res/color/primary_text_dark.xml from drawable resource ID #0x1060001
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:847)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:631)
at android.content.res.Resources.loadDrawable(Resources.java:897)
at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:955)
at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
at android.view.View.<init>(View.java:5010)
at android.view.ViewGroup.<init>(ViewGroup.java:659)
at android.widget.LinearLayout.<init>(LinearLayout.java:244)
at android.widget.LinearLayout.<init>(LinearLayout.java:240)
at android.widget.LinearLayout.<init>(LinearLayout.java:236)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
2021-06-14 12:42:10.331 26833-26833/com.helpcars.app E/AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.helpcars.app.Fragments.HomeFragment.onCreateView(HomeFragment.java:308)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #18: <item> tag requires a 'drawable' attribute or child tag defining a drawable
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:190)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:122)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1332)
at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1291)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:833)
... 42 more
This is the XML of the layout I'm trying to "Inflate".
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Map frame -->
<LinearLayout
android:id="#+id/mapLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/provider_map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<!--Project Flow-->
<!--Request to providers-->
<LinearLayout
android:id="#+id/lnrRequestProviders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#android:color/white"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rcvServiceTypes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/_5sdp"
android:layout_marginTop="#dimen/_5sdp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/view_bg" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/_10sdp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="#+id/imgPaymentType"
android:layout_width="#dimen/_20sdp"
android:layout_height="#dimen/_20sdp"
app:srcCompat="#drawable/money1" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblPaymentType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="#string/selected_payment_mode"
android:textColor="#android:color/black"
android:textSize="16sp" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblPaymentChange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="#string/change"
android:textColor="#android:color/holo_blue_dark"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<com.helpcars.app.Utils.MyButton
android:id="#+id/btnRequestRides"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="#dimen/_10sdp"
android:layout_marginLeft="#dimen/_20sdp"
android:layout_marginRight="#dimen/_20sdp"
android:layout_marginTop="#dimen/_10sdp"
android:background="#drawable/rounded_button"
android:text="#string/estimate"
android:textColor="#color/button_text_color" />
</LinearLayout>
<!-- Provider popup Layout-->
<LinearLayout
android:id="#+id/lnrProviderPopup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="#+id/lnrHidePopup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/transparent_black"
android:orientation="vertical"
android:visibility="gone">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#android:color/primary_text_dark"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/_10sdp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/imgProviderPopup"
android:layout_width="#dimen/_60sdp"
android:layout_height="#dimen/_60sdp"
android:layout_marginTop="#dimen/_5sdp"
android:src="#drawable/pickup_drop_icon" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblServiceName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:gravity="center"
android:maxLines="1"
android:text=""
android:textColor="#color/text_color_black"
android:textSize="#dimen/_14sdp" />
<com.helpcars.app.Utils.MyBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_5sdp"
android:gravity="center"
android:maxLines="1"
android:text="Aguarde o reboque em um local seguro"
android:textColor="#color/text_color_black"
android:textSize="#dimen/_14sdp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="#dimen/_10sdp"
android:background="#android:color/primary_text_dark"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="#+id/lnrPriceBase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.helpcars.app.Utils.MyBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start"
android:maxLines="1"
android:text="Base Price"
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblBasePricePopup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="end"
android:maxLines="1"
android:text=""
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
</LinearLayout>
<LinearLayout
android:id="#+id/lnrPricekm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:orientation="horizontal">
<com.helpcars.app.Utils.MyBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|center"
android:maxLines="1"
android:text="Price/km"
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblPriceKm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="end"
android:maxLines="1"
android:text=""
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
</LinearLayout>
<LinearLayout
android:id="#+id/lnrPricemin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:orientation="horizontal">
<com.helpcars.app.Utils.MyBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|center"
android:maxLines="1"
android:text="Price/min"
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblPriceMin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="end"
android:maxLines="1"
android:text=""
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
</LinearLayout>
<LinearLayout
android:id="#+id/lnrCalculationType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:orientation="horizontal">
<com.helpcars.app.Utils.MyBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|center"
android:maxLines="1"
android:text="- É obrigatório o acompanhamento do responsável"
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
</LinearLayout>
<LinearLayout
android:id="#+id/lnrCapacity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:orientation="horizontal">
<com.helpcars.app.Utils.MyBoldTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="start|center"
android:maxLines="1"
android:text="- Para remoção, somente veículos descarregados"
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblCapacity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="end"
android:maxLines="1"
android:text=""
android:textColor="#color/black_text_color"
android:textSize="#dimen/_12sdp" />
</LinearLayout>
</LinearLayout>
<com.helpcars.app.Utils.MyBoldTextView
android:id="#+id/lblProviderDesc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_15sdp"
android:layout_weight="1"
android:lineSpacingMultiplier="1.3"
android:text="The fare will be the price presented upon booking, or, if the journey changes, the fare will be based on the rates provided. Tap fare for details."
android:textSize="#dimen/_10sdp" />
</LinearLayout>
HomeFragment
#Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container,
Bundle savedInstanceState) {
if (rootView == null) {
rootView = inflater.inflate(R.layout.fragment_home, container, false);
}
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
init(rootView);
//permission to access location
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// Android M Permission check
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
} else {
initMap();
MapsInitializer.initialize(getActivity());
}
}
}, 500);
return rootView;
}
The detail is that it works for various devices and android versions, but specifically for the Moto G Android Pie I get this error.
The error is on the XML file line #133, but I couldn't understand why the LinearLayout starts there.
Possible solution based on the provided source code:
Check if you have used android:src instead of app:srcCompat to assign vector assets. Is #drawable/pickup_drop_icon a vector asset? If yes, you should NOT use android:src.
You forgot to place the trailing </LinearLayout> of the parent.
Add </LinearLayout> to the bottom of your code.
Try code folding the XML file, you will notice that it is missing a </LinearLayout> at the end.
when the compiler gives a generic error message Binary XML file line #133: Error inflating class, I recommend that you first identify if there are any errors in the XML file.
Let me know if you have any questions.

(< API 24) NavigationView Error (inflating class) (works in API24+)

So I have a problem with devices that are below API 24. My code works in API 24+
I always get an error when I try to set the layout of my NavDrawer:
setContentView(R.layout.activity_nav_drawer);
Layout File:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="#layout/app_bar_nav_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.navigation.NavigationView
android:id="#+id/nav_view"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_nav_drawer"
app:itemIconTint="#color/colorPrimary"
app:menu="#menu/activity_nav_drawer_drawer" />
</androidx.drawerlayout.widget.DrawerLayout>
MANIFEST (Theme):
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:networkSecurityConfig="#xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppTheme">
Changed the AppThme no it gives me this error from the Fragment.
Again its loading the layout and gives me this error:
The line where the error occurs is a Webview
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.streamdev.aiostreamer/com.streamdev.aiostreamer.NavDrawer}: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
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 com.streamdev.aiostreamer.ui.HQPFragment.onCreateView(HQPFragment.java:69)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.addAddedFragments(FragmentManagerImpl.java:2100)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1874)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2624)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:904)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
at android.app.Activity.performStart(Activity.java:6006)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
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:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) 
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809) 
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 com.streamdev.aiostreamer.ui.HQPFragment.onCreateView(HQPFragment.java:69) 
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600) 
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881) 
at androidx.fragment.app.FragmentManagerImpl.addAddedFragments(FragmentManagerImpl.java:2100) 
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1874) 
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830) 
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727) 
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663) 
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613) 
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2624) 
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:904) 
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238) 
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303) 
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659) 
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613) 
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246) 
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542) 
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201) 
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236) 
at android.app.Activity.performStart(Activity.java:6006) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2288) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
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:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2040003
at android.content.res.Resources.getText(Resources.java:299)
at android.conten
My activity main.xml (all fragments uses this one):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="#+id/scrollView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#202020"
>
<LinearLayout
android:id="#+id/relative"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#202020"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<WebView
android:id="#+id/adview"
android:layout_alignParentTop="true"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#202020"/>
<com.streamdev.aiostreamer.ui.ExpandableHeightGridView
android:id="#+id/customgrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/os_texts"
android:background="#202020"
android:gravity="center"
android:horizontalSpacing="2dp"
android:listSelector="#00000000"
android:numColumns="2"
android:paddingTop="0dp"
android:verticalSpacing="10dp">
</com.streamdev.aiostreamer.ui.ExpandableHeightGridView>
<WebView
android:id="#+id/adview2"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="60dp"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp"
android:paddingTop="0dp"
android:background="#202020"/>
</LinearLayout>
</ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="#color/colorPrimary"
app:itemIconTint="#FFFFFF"
app:itemTextColor="#FFFFFF"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="#menu/bottom_nav_menu" />
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<AutoCompleteTextView
android:id="#+id/searchtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:completionThreshold="1"
android:hint="Search..."
android:maxLines="1"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
/>
<Button
android:id="#+id/searchbutton"
style="#style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Your first line of the error showing that below view is the reason of the issue.
<com.streamdev.aiostreamer.ui.ExpandableHeightGridView
android:id="#+id/customgrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/os_texts"
android:background="#202020"
android:gravity="center"
android:horizontalSpacing="2dp"
android:listSelector="#00000000"
android:numColumns="2"
android:paddingTop="0dp"
android:verticalSpacing="10dp">
</com.streamdev.aiostreamer.ui.ExpandableHeightGridView>

Not able to set another image below first image in linear layout

I'm working on some project and i use linear layout and set image and text in it. after ending first linear layout i want another linear layout and set image. But i'm setting image my app keep on crashing.
This is Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".guidance_new"
android:id="#+id/layout"
android:background="#drawable/bg_animation"
android:orientation="horizontal"
android:padding="16dp">
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/hanging_lamp"
android:src="#drawable/bulb1"/>
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="vertical"
>
<TextView
android:layout_width="150dp"
android:layout_height="70dp"
android:text="100W Bulb"
android:textColor="#000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="180dp"
android:id="#+id/textView1"/>
<TextView
android:layout_width="150dp"
android:layout_height="80dp"
android:text="Price:100/. Voltage:220V-240V ."
android:textColor="#a9a9a9"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="180dp"
android:id="#+id/textView2"/>
/////// layout is set here
</LinearLayout>
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/chandlier"
android:src="#drawable/chandelier"
android:layout_below="#id/linear1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_below="#id/linear1">
<TextView
android:layout_width="150dp"
android:layout_height="70dp"
android:text="Chandlier"
android:textColor="#000"
android:textStyle="bold"
android:layout_marginLeft="180dp"
android:textSize="20sp"/>
</LinearLayout>
</RelativeLayout>
And this is mainlog:
06-09 18:26:34.348 23904-23904/com.example.animation E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.animation, PID: 23904
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.animation/com.example.animation.guidance_new}: android.view.InflateException: Binary XML file line #52: Binary XML file line #52: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
at android.app.ActivityThread.access$900(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
Caused by: android.view.InflateException: Binary XML file line #52: Binary XML file line #52: Error inflating class ImageView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.animation.guidance_new.onCreate(guidance_new.java:20)
at android.app.Activity.performCreate(Activity.java:6248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
at android.app.ActivityThread.access$900(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:168) 
at android.app.ActivityThread.main(ActivityThread.java:5845) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
Caused by: android.view.InflateException: Binary XML file line #52: Error inflating class ImageView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.animation.guidance_new.onCreate(guidance_new.java:20) 
at android.app.Activity.performCreate(Activity.java:6248) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
at android.app.ActivityThread.access$900(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:168) 
at android.app.ActivityThread.main(ActivityThread.java:5845) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.animation:drawable/chandelier" (7f060064) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060064 a=-1 r=0x7f060064}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2617)
at android.content.res.Resources.loadDrawable(Resources.java:2555)
at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
at android.widget.ImageView.<init>(ImageView.java:152)
at android.widget.ImageView.<init>(ImageView.java:140)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:72)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:182)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
at android.support.v7.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:746)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.example.animation.guidance_new.onCreate(guidance_new.java:20) 
at android.app.Activity.performCreate(Activity.java:6248) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
at android.app.ActivityThread.access$900(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:168) 
at android.app.ActivityThread.main(ActivityThread.java:5845) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
06-09 18:26:34.357 23904-23927/com.example.animation V/FA: Connection attempt already in progress
Resource that you are trying to display in ImageView (chandelier) is invalid.
You can read in your log that: Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.animation:drawable/chandelier" (7f060064) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060064 a=-1 r=0x7f060064} Check if path to the file is correct and try to display other image.
Try this xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".guidance_new"
android:id="#+id/layout"
android:background="#drawable/bg_animation"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/hanging_lamp"
android:src="#drawable/bulb1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="70dp"
android:text="100W Bulb"
android:textColor="#000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="30dp"
android:id="#+id/textView1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="80dp"
android:text="Price:100/. Voltage:220V-240V ."
android:textColor="#a9a9a9"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginLeft="30dp"
android:id="#+id/textView2"/>
</LinearLayout>
/////// layout is set here
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/chandelier"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="#+id/chandlier"
android:src="#drawable/bulb1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="70dp"
android:textColor="#000"
android:textStyle="bold"
android:text="Chandlier"
android:textSize="20sp"
android:layout_marginLeft="30dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

I encountered this error in android studio while learning it

I encountered this error in android studio while learning it:
08-20 11:56:52.192 9815-9815/com.example.android.courtcountee1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.courtcountee1, PID: 9815
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.courtcountee1/com.example.android.courtcountee1.MainActivity}: android.view.InflateException: Binary XML file line #66: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
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 #66: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.android.courtcountee1.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) 
at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:7325) 
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.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at com.example.android.courtcountee1.MainActivity.onCreate(MainActivity.java:15) 
at android.app.Activity.performCreate(Activity.java:6904) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) 
at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:7325) 
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) 
The XML
i THINK THE VIEW TAG IS CAUSING THE PROBLEM AS REMOVING IT RESOLVED THIS
<?xml version="1.0" encoding="utf-8"?>
<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:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="24dp"
android:layout_weight="1"
android:orientation="vertical"
tools:context="com.example.android.courtcounter.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="Team A" />
<TextView
android:id="#+id/team_a_score"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:fontFamily="sans-serif-light"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="0"
android:textColor="#000000"
android:textSize="56dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="threePoints"
android:text="+3 POINTS" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="twoPoints"
android:text="+2 POINTS" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="freeThrow"
android:text="Free Throw" />
</LinearLayout>
<!--<view
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:background="#android:color/darker_gray">
</view>-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="24dp"
android:layout_weight="1"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="Team B"
android:textColor="#616161"
android:textSize="14sp" />
<TextView
android:id="#+id/team_b_score"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:fontFamily="sans-serif-light"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="0"
android:textColor="#000000"
android:textSize="56dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="threePointsB"
android:text="+3 POINTS" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="twoPointsB"
android:text="+2 POINTS" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="freeThrowB"
android:text="Free Throw" />
</LinearLayout>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="32dp"
android:onClick="reset"
android:text="RESET" />
</RelativeLayout>
View tag must start with the capital letter, like this:
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:background="#android:color/darker_gray">
</View>
In fact,Every xml View tag will through the LayoutInflater class construct a real View class. About LayoutInflater, It will combine the xml tag with the View class in package android.view.、android.widget、android.webkit、android.app. About you use the view tag, you should use like this.
<view
android:id="#+id/test"
android:layout_width="40dp"
android:layout_height="40dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
class="androidx.constraintlayout.utils.widget.ImageFilterView"
android:background="#color/colorAccent"
/>
you must appoint the target class. because the LayoutInflater tell us should do.
View createViewFromTag(View parent, String name, Context context, AttributeSet attrs,
boolean ignoreThemeAttr) {
if (name.equals("view")) {
name = attrs.getAttributeValue(null, "class");
}
// Apply a theme wrapper, if allowed and one is specified.
if (!ignoreThemeAttr) {
final TypedArray ta = context.obtainStyledAttributes(attrs, ATTRS_THEME);
final int themeResId = ta.getResourceId(0, 0);
if (themeResId != 0) {
context = new ContextThemeWrapper(context, themeResId);
}
ta.recycle();
}
if (name.equals(TAG_1995)) {
// Let's party like it's 1995!
return new BlinkLayout(context, attrs);
}
...
because you not appoint the class.It can not find the real class about it,So It cause the exception.

Categories

Resources