Error inflating class info.hoang8f.widget.FButton - java

Error Log:
10-26 12:22:33.144 26926-26926/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: ksmk.sahip.com.ecom, PID: 26926
java.lang.RuntimeException: Unable to start activity ComponentInfo{ksmk.sahip.com.ecom/ksmk.sahip.com.ecom.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at ksmk.sahip.com.ecom.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
at android.content.res.TypedArray.getColor(TypedArray.java:463)
at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
at info.hoang8f.widget.FButton.(FButton.java:52)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at ksmk.sahip.com.ecom.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
10-26 12:22:33.692 1305-1305/? E/EGL_emulation: tid 1305: eglCreateSyncKHR(1901): error 0x3004 (EGL_BAD_ATTRIBUTE)

use this dependency this is will solve error
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
use this in code for casting the button
Button btn_CreateNewVideo;
btn_CreateNewVideo = (FButton) findViewById(R.id.createnewvideo);

As of this time the problem occurs in android gradle plugin version 3.0.0. So just change the android gradle plugin version to 2.3.3. You can change it in build.gradle (Project level) file, like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

If you have updated your android studio version to 3.o then go to file -> Project Structure -> Project -> Change gradle plugin version to 2.3.0 and gradle version to 3.3
I hope this helps

Same Flat FButton theme can be found here:
Use the library as a dependency https://github.com/jd-alexander/android-flat-button
https://jitpack.io/#jd-alexander/android-flat-button/v1.1
dependencies {
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
}

Another solution I have found
Change for:
Dependence {
implementation 'info.hoang8f:android-segmented:1.0.6'
}
or
You can change casting (FButton) to (Button) with same previous dependency

So, some time ago I've got the exactly same error 'cause my Android Studio Version is higher than the version for which info.hoang8f was implemented, so, step-by-step how to fix it:
In your build.gradle project:level add this line inside allprojects -> repositories: maven { url 'https://jitpack.io' }
In your build.gradle app:level add this line in dependencies: implementation 'com.github.jd-alexander:android-flat-button:v1.1'
Remove the implementation line of 'info.hoang8f...' and Clean Project;
Remember, this new implementation use fButtonColor, so, you need to change in your XML files app:buttonColor='#color/someColor' to: app:fButtonColor='#color/someColor'
Do not:
Change your Gradle Version, this can raise some implementation errors;

Related

Error inflating Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView

Running app on Android version 7.1.1 device. Was working perfectly then suddenly I got this inflation exception error.
XML file:
<com.google.android.material.textview.MaterialTextView
android:id="#+id/titleLogin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:paddingStart="20dp"
android:paddingTop="20dp"
android:paddingBottom="10dp"
android:text="Login"
android:textColor="#color/black"
android:textSize="34sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0"
app:layout_constraintWidth_percent=".8" />
Logcat:
Caused by: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: android.view.InflateException: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: java.lang.reflect.InvocationTargetException
I tried changing MaterialTextView to TextView, did not work.
As I don't have any drawable or layouts imported I don't know why the problem is there. As I said, was working fine one moment and crashed the next.
Does the same with a button as well...
Stack trace:
2022-10-29 21:16:00.512 12386-12386/com.poweredbyralph.southernlines E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.poweredbyralph.southernlines, PID: 12386
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.poweredbyralph.southernlines/com.poweredbyralph.southernlines.LoginActivity}: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2798)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2863)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6410)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
Caused by: android.view.InflateException: Binary XML file line #53: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: android.view.InflateException: Binary XML file line #53: Error inflating class com.google.android.material.textview.MaterialTextView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.poweredbyralph.southernlines.LoginActivity.onCreate(LoginActivity.java:39)
at android.app.Activity.performCreate(Activity.java:6681)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2863)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6410)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=56; index=930
at android.content.res.StringBlock.get(StringBlock.java:65)
at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:1218)
at android.content.res.TypedArray.getText(TypedArray.java:168)
at android.widget.TextView.<init>(TextView.java:1028)
2022-10-29 21:16:00.512 12386-12386/com.poweredbyralph.southernlines E/AndroidRuntime: at android.widget.TextView.<init>(TextView.java:731)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:108)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:88)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:83)
... 31 more
#CommonsWare, this "The error seems to be complaining about a string resource" actually gave me an idea. I changed my TextViews and Buttons to use strings from the strings file rather than adding them directly.
android:text="Login"
TO:
android:text="#string/login"
Problem solved!!
Thanks for pointing String resource out:)

How to show a custom View class in a nested layout?

I have made a custom class extending from View public class MyView extends View which draws a math function. I want it to be drawn in activity with two/nested (don't know which term is more accurate) layouts.
I know how to show it in simple empty activity:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(myView(this)); //draws function on entire screen
}
}
But to show it in activity which XML looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout>
<ConstraintLayout>
//draw my function here
</ConstraintLayout>
<ConstraintLayout>
</ConstraintLayout>
</LinearLayout>
I have no idea :( Or maybe my approach is all wrong? Please help
As to Eixx's answer, Im getting error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pwtafunc.marko.pwtafunc/com.pwtafunc.marko.pwtafunc.DrawFuncActivity}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class com.pwtafunc.marko.pwtafunc.Func
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class com.pwtafunc.marko.pwtafunc.Func
Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class com.pwtafunc.marko.pwtafunc.Func
Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]
at java.lang.Class.getConstructor0(Class.java:2204)
at java.lang.Class.getConstructor(Class.java:1683)
at android.view.LayoutInflater.createView(LayoutInflater.java:618)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.pwtafunc.marko.pwtafunc.DrawFuncActivity.onCreate(DrawFuncActivity.java:16)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
As to what Kling Klang wrote, sorry my mistake, it was NullPointerException, but when I dealt with the function is drawn on the entire screen anyway :(
And Marcin Grabowski solution is the right one, thank You very much.
You can just insert it into the XML, like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout>
<ConstraintLayout>
<com.example.MyView/>
</ConstraintLayout>
<ConstraintLayout>
</ConstraintLayout>
</LinearLayout>
You can also add it from code
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ConstraintLayout constraintLayout = findViewById(R.id.your_constraint_layout_id);
constraintLayout.addView(myView(this));
}
}
plus to Eixx's answer.
To allow your view be used in XML layout file directly, you will need to at least implement constructor
public MyView(Context context, AttributeSet attrs)

Runtime error on newly created google map activity

I just created a new google map activity in android studio but its giving runtime error. i am also using firebase in this project. im not that new in android development but this is my first time using google maps api. kindly help
MapsActivity.java
package com.dreamfighter.roomrental;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
// LatLng sydney = new LatLng(-34, 151);
// mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
// mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
activty_maps.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dreamfighter.roomrental">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="i dont want my api key on stack overflow" />
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login" />
<activity
android:name=".RegisterActivity"
android:label="#string/title_activity_register" />
<activity android:name=".single_full_post" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps"></activity>
</application>
</manifest>
Error:
11-24 02:05:00.185 14219-14219/com.dreamfighter.roomrental E/BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
11-24 02:05:00.397 14219-14219/com.dreamfighter.roomrental E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dreamfighter.roomrental/com.dreamfighter.roomrental.MapsActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: calling Fragment constructor caused an exception
at android.support.v4.app.Fragment.instantiate(Fragment.java:481)
at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3664)
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338)
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:446)
at android.app.Activity.setContentView(Activity.java:2544)
at com.dreamfighter.roomrental.MapsActivity.onCreate(MapsActivity.java:20)
at android.app.Activity.performCreate(Activity.java:6942)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.support.v4.app.Fragment.instantiate(Fragment.java:459)
at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33) 
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3664) 
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) 
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338) 
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) 
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:496) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:378) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:446) 
at android.app.Activity.setContentView(Activity.java:2544) 
at com.dreamfighter.roomrental.MapsActivity.onCreate(MapsActivity.java:20) 
at android.app.Activity.performCreate(Activity.java:6942) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
at android.app.ActivityThread.-wrap14(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6682) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 
Caused by: java.lang.IllegalAccessError: Class com.google.android.gms.dynamic.zza extended by class com.google.android.gms.maps.SupportMapFragment$zzb is inaccessible (declaration of 'com.google.android.gms.maps.SupportMapFragment$zzb' appears in /data/app/com.dreamfighter.roomrental-1/split_lib_dependencies_apk.apk:classes2.dex)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
at android.support.v4.app.Fragment.instantiate(Fragment.java:459) 
at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33) 
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3664) 
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) 
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338) 
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) 
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:496) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:378) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:446) 
at android.app.Activity.setContentView(Activity.java:2544) 
at com.dreamfighter.roomrental.MapsActivity.onCreate(MapsActivity.java:20) 
at android.app.Activity.performCreate(Activity.java:6942) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
at android.app.ActivityThread.-wrap14(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6682) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 
--------- beginning of crash
11-24 02:05:00.397 14219-14219/com.dreamfighter.roomrental E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.dreamfighter.roomrental, PID: 14219
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dreamfighter.roomrental/com.dreamfighter.roomrental.MapsActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: calling Fragment constructor caused an exception
at android.support.v4.app.Fragment.instantiate(Fragment.java:481)
at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3664)
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338)
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:446)
at android.app.Activity.setContentView(Activity.java:2544)
at com.dreamfighter.roomrental.MapsActivity.onCreate(MapsActivity.java:20)
at android.app.Activity.performCreate(Activity.java:6942)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.support.v4.app.Fragment.instantiate(Fragment.java:459)
at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33) 
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3664) 
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) 
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338) 
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) 
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:496) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:378) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:446) 
at android.app.Activity.setContentView(Activity.java:2544) 
at com.dreamfighter.roomrental.MapsActivity.onCreate(MapsActivity.java:20) 
at android.app.Activity.performCreate(Activity.java:6942) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
at android.app.ActivityThread.-wrap14(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6682) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 
Caused by: java.lang.IllegalAccessError: Class com.google.android.gms.dynamic.zza extended by class com.google.android.gms.maps.SupportMapFragment$zzb is inaccessible (declaration of 'com.google.android.gms.maps.SupportMapFragment$zzb' appears in /data/app/com.dreamfighter.roomrental-1/split_lib_dependencies_apk.apk:classes2.dex)
at java.lang.reflect.Constructor.newInstance0(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
at android.support.v4.app.Fragment.instantiate(Fragment.java:459) 
at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:33) 
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3664) 
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111) 
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:338) 
at android.support.v4.app.BaseFragmentActivityApi14.onCreateView(BaseFragmentActivityApi14.java:39) 
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:67) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:496) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:427) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:378) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:446) 
at android.app.Activity.setContentView(Activity.java:2544) 
at com.dreamfighter.roomrental.MapsActivity.onCreate(MapsActivity.java:20) 
at android.app.Activity.performCreate(Activity.java:6942) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
at android.app.ActivityThread.-wrap14(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6682) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.dreamfighter.roomrental"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.master.android:glideimageview:1.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
I also had the same issue and I was resolved using the following steps.
It is mainly version issues. Firebase supports only latest versions. if you are using firebase analytics ( implementation 'com.google.firebase:firebase-core:16.0.1'), then we should use latest google services. so you are using 12.0.1, it would not support.
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
The above versions resolved my problem.
Solution Found:
Replace classpath 'com.google.gms:google-services:4.0.1' to classpath 'com.google.gms:google-services:3.2.1' in project level build.gradle file.
Update
Solution Found again:
Error came back again after i added some more dependencies. Just Update all dependencies to their latest versions and it will solve the problem.

RecyclerView and CoordinatorLayout with id are crashing

When I started writing nested fragments I encountered an unexpected problem. When the application is killed by Android, e.g. when there is a small amount of free RAM, the application throws the following exception after resuming it.
E/Parcel: Class not found when unmarshalling: android.support.design.widget.CoordinatorLayout$SavedState
java.lang.ClassNotFoundException: android.support.design.widget.CoordinatorLayout$SavedState
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at android.os.Parcel.readParcelableCreator(Parcel.java:2888)
at android.os.Parcel.readParcelable(Parcel.java:2842)
at android.os.Parcel.readValue(Parcel.java:2745)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:3195)
at android.os.Parcel.readSparseArray(Parcel.java:2407)
at android.os.Parcel.readValue(Parcel.java:2802)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3114)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273)
at android.os.BaseBundle.unparcel(BaseBundle.java:226)
at android.os.BaseBundle.putBoolean(BaseBundle.java:532)
at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:960)
at android.support.v4.app.FragmentStatePagerAdapter.instantiateItem(FragmentStatePagerAdapter.java:121)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1004)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1186)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1086)
at android.support.v4.view.ViewPager$3.run(ViewPager.java:267)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:655)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
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.ClassNotFoundException: android.support.design.widget.CoordinatorLayout$SavedState
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:1355)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:1415)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:453) 
at android.os.Parcel.readParcelableCreator(Parcel.java:2888) 
at android.os.Parcel.readParcelable(Parcel.java:2842) 
at android.os.Parcel.readValue(Parcel.java:2745) 
at android.os.Parcel.readSparseArrayInternal(Parcel.java:3195) 
at android.os.Parcel.readSparseArray(Parcel.java:2407) 
at android.os.Parcel.readValue(Parcel.java:2802) 
at android.os.Parcel.readArrayMapInternal(Parcel.java:3114) 
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273) 
at android.os.BaseBundle.unparcel(BaseBundle.java:226) 
at android.os.BaseBundle.putBoolean(BaseBundle.java:532) 
at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:960) 
at android.support.v4.app.FragmentStatePagerAdapter.instantiateItem(FragmentStatePagerAdapter.java:121) 
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1004) 
at android.support.v4.view.ViewPager.populate(ViewPager.java:1186) 
at android.support.v4.view.ViewPager.populate(ViewPager.java:1086) 
at android.support.v4.view.ViewPager$3.run(ViewPager.java:267) 
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) 
at android.view.Choreographer.doCallbacks(Choreographer.java:723) 
at android.view.Choreographer.doFrame(Choreographer.java:655) 
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) 
at android.os.Handler.handleCallback(Handler.java:790) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
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.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.design.widget.CoordinatorLayout$SavedState
at android.os.Parcel.readParcelableCreator(Parcel.java:2916)
at android.os.Parcel.readParcelable(Parcel.java:2842)
at android.os.Parcel.readValue(Parcel.java:2745)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:3195)
at android.os.Parcel.readSparseArray(Parcel.java:2407)
at android.os.Parcel.readValue(Parcel.java:2802)
at android.os.Parcel.readArrayMapInternal(Parcel.java:3114)
at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:273)
at android.os.BaseBundle.unparcel(BaseBundle.java:226)
at android.os.BaseBundle.putBoolean(BaseBundle.java:532)
at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:960)
at android.support.v4.app.FragmentStatePagerAdapter.instantiateItem(FragmentStatePagerAdapter.java:121)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1004)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1186)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1086)
at android.support.v4.view.ViewPager$3.run(ViewPager.java:267)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:655)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
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 error occurs only if RecyclerView or CoordinatorLayout in tab fragment are assigned in xml android id.
In order to identify the error, I wrote an application in which I reproduced it.
https://github.com/RicomenPL/SampleBPE
How to reproduce it?
Enable "dont keep activies" in the development options on the smartphone or emulator
Turn on the SampleBPE application
Move to tabs left or right
Now you have to leave with the Home key
Enter again with the use of the recent apps key
Moving the tabs to the left or right will cause an error
The problem was solved when I downgrade my support libraries to version 26.1.0. This is a temporary solution, to avoid the problem. I hope that in version 28, this will be resolved.

how to fix java.lang.NoClassDefFoundError crash

My app is live on play store. Its not crashing in all devices but I can see this crash in a few device only. Please help me to fix this issue.
java.lang.NoClassDefFoundError: Failed resolution of:
Lcom/google/android/gms/auth/api/phone/SmsRetriever; at
com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250)
at
com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188)
at
com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372)
at
com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:627)
at
com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57)
at
com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189)
at
com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176)
at
android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at
android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at
android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102) at
android.os.Looper.loop(Looper.java:148) at
android.app.ActivityThread.main(ActivityThread.java:5417) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused
by: java.lang.ClassNotFoundException: Didn't find class
"com.google.android.gms.auth.api.phone.SmsRetriever" on path:
DexPathList[[zip file
"/data/app/gharkadabba.gharkadabba-1/base.apk"],nativeLibraryDirectories=[/data/app/gharkadabba.gharkadabba-1/lib/x86,
/vendor/lib, /system/lib]] at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at
java.lang.ClassLoader.loadClass(ClassLoader.java:469) at
com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250) 
at
com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188) 
at
com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372) 
at
com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:627) 
at
com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57) 
at
com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189) 
at
com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176) 
at
android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297) 
at
android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46) 
at
android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116) 
at android.os.Handler.dispatchMessage(Handler.java:102)  at
android.os.Looper.loop(Looper.java:148)  at
android.app.ActivityThread.main(ActivityThread.java:5417)  at
java.lang.reflect.Method.invoke(Native Method)  at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Suppressed: java.lang.ClassNotFoundException:
com.google.android.gms.auth.api.phone.SmsRetriever at
java.lang.Class.classForName(Native Method) at
java.lang.BootClassLoader.findClass(ClassLoader.java:781) at
java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at
java.lang.ClassLoader.loadClass(ClassLoader.java:504)
Caused by: java.lang.NoClassDefFoundError: Class not found using
the boot class loader; no stack trace available
I can see Moto G (3rd & 4th Gen), One Plus one device having crash.
I added below line to ProGuard file.
-ignorewarnings
-keep class * { public private *; }
SMS Retriever API is available in Google Play Services v10.2 and is used to auto-verify the OTP SMS.
https://developers.google.com/identity/sms-retriever/
This API will not be available in the devices that do not have Google Play Services installed - like Amazon Fire devices or the devices in the Chinese region.
If you are using this API, you have to check whether Play services are installed in the device before accessing this API.
Looking at your exception, it seems this API has been used by some Facebook kit.

Categories