After login when starting MainActivity app crashes trying to inflate a view
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
in this line
setContentView(R.layout.chat_sdk_activity_view_pager);
in order to start an app I have to remove this line from PagerSlidingTabStrip style
<item name="pstsShouldExpand">true</item>
My phone is Samsung note 4, with stock android version 6.0.1 tell me what other info I could provide.
This happens when I compile official rep myself, demo works fine
This happens on android 7.1.2, Nexus 6P. I got desperate and simply cloned that library (it's one java file and three xml files) into chat ui sdk and commented out the line in the java there that crashes for whatever reason.
Whoever wrote this needs to test it by making a new project and following their directions - they would see all these problems right away.
I am also facing this issue, once I remove
<item name="pstsShouldExpand">true</item>
the app doesn't crash but I don't know if this piece of code is necessary for the feature to run
not working after removing
I can't reproduce this issue. Can you try using the new Gradle version and updated setup instructions? If you can reproduce it, please reopen the issue.
Same issues. Crashes after any log in attempt. Tried StevenWoo solution, but still not working. In this still being investigated?
This was caused by some of the Gradle packages not being imported correctly. This was solved by adding the following:
compile 'co.chatsdk.chatsdk:chat-sdk-core:4.0.5'
compile 'co.chatsdk.chatsdk:chat-sdk-ui:4.0.5'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.0.5'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.0.5'
If you are still seeing problems can you tell me the following:
- Do you get this issue with Github version of the project with no modifications?
- What is the stack trace?
- Can you post the code from your Application
onCreatemethod - Can you post the contents of your
build.gradlefile
Yes the github version. Only changes that were made were was updating the sdk versions, and adding meta to the android manifest as I was get null pointer exceptions.
onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context context = getApplicationContext();
Configuration.Builder builder = new Configuration.Builder(context);
builder.firebaseRootPath("prod");
ChatSDK.initialize(builder.build());
UserInterfaceModule.activate(context);
FirebaseModule.activate();
FirebaseFileStorageModule.activate();
InterfaceManager.shared().a.startLoginActivity(context, true);
}
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "chat.chacharoom.chatrooms"
minSdkVersion 16
targetSdkVersion 27
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'co.chatsdk.chatsdk:chat-sdk-core:4.0.5'
compile 'co.chatsdk.chatsdk:chat-sdk-ui:4.0.5'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.0.5'
compile 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.0.5'
}
apply plugin: 'com.google.gms.google-services'
Stack Trace
11-27 19:26:02.108 3982-3982/chat.chacharoom.chatrooms E/AndroidRuntime: FATAL EXCEPTION: main
Process: chat.chacharoom.chatrooms, PID: 3982
java.lang.RuntimeException: Unable to start activity ComponentInfo{chat.chacharoom.chatrooms/co.chatsdk.ui.main.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
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.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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at co.chatsdk.ui.main.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 5 to dimension: type=0x12
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:148)
at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:106)
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.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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at co.chatsdk.ui.main.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
11-27 19:26:02.109 3982-3982/chat.chacharoom.chatrooms E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{chat.chacharoom.chatrooms/co.chatsdk.ui.main.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
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.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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at co.chatsdk.ui.main.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 5 to dimension: type=0x12
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:148)
at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:106)
Here is my manifest as well
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="chat.chacharoom.chatrooms">
<uses-permission android:name="android.permission.INTERNET" />
<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="firebase_url" android:value="@string/firebase_url" />
<meta-data android:name="firebase_root_path" android:value="@string/firebase_root_path" />
<meta-data android:name="firebase_storage_url" android:value="@string/firebase_storage_url" />
<meta-data android:name="cloud_messaging_server_key" android:value="@string/firebase_cloud_messaging_server_key" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="co.chatsdk.ui.login.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Also seeing this problem after following the git instructions.. crashes after login Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
Running Android 7.0
Guys for me the app is getting looped at the authentication time Pls help me
also facing the same issues. Crashes after log in or register attempt Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
Running Android 7.0 , Android 5.1
Could someone post a link to their project file that demonstrates this issue? Then I can download it and test it locally.
This appears to be an issue with later versions of Android. I'll look at replacing the sliding tab bar with a TabLayout.
The PagerSlidingTabStrip has been replaced with a TabLayout so this should be fixed in version 4.0.7.