跟着视频敲完语音章节,点击聊天界面APP崩了

来源:14-5 语音下载与播放的调度实现

passerbyYSQ

2020-02-20

2020-02-19 17:19:11.490 20612-20612/net.qiujuer.italker.push E/AndroidRuntime: FATAL EXCEPTION: main

    Process: net.qiujuer.italker.push, PID: 20612

    java.lang.RuntimeException: Unable to start activity ComponentInfo{net.qiujuer.italker.push/net.qiujuer.italker.push.activities.MessageActivity}: android.view.InflateException: Binary XML file line #128: Binary XML file line #16: Binary XML file line #8: Error inflating class net.qiujuer.italker.common.widget.AudioRecordView

        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2982)

        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3060)

        at android.app.ActivityThread.-wrap11(Unknown Source:0)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769)

        at android.os.Handler.dispatchMessage(Handler.java:106)

        at android.os.Looper.loop(Looper.java:192)

        at android.app.ActivityThread.main(ActivityThread.java:6840)

        at java.lang.reflect.Method.invoke(Native Method)

        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

     Caused by: android.view.InflateException: Binary XML file line #128: Binary XML file line #16: Binary XML file line #8: Error inflating class net.qiujuer.italker.common.widget.AudioRecordView

     Caused by: android.view.InflateException: Binary XML file line #16: Binary XML file line #8: Error inflating class net.qiujuer.italker.common.widget.AudioRecordView

     Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class net.qiujuer.italker.common.widget.AudioRecordView

     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:656)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:835)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:775)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:908)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1040)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:904)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:521)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)

        at net.qiujuer.italker.common.app.Fragment.onCreateView(Fragment.java:41)

        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)

        at androidx.fragment.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManagerImpl.java:1138)

        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:851)

        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1133)

        at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1393)

        at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3205)

        at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:817)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:775)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:908)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:911)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:521)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)

        at net.qiujuer.italker.common.app.Fragment.onCreateView(Fragment.java:41)

        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)

2020-02-19 17:19:11.494 20612-20612/net.qiujuer.italker.push E/AndroidRuntime:     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.dispatchStateChange(FragmentManagerImpl.java:2663)

        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:1340)

        at android.app.Activity.performStart(Activity.java:7145)

        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2945)

        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3060)

        at android.app.ActivityThread.-wrap11(Unknown Source:0)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769)

        at android.os.Handler.dispatchMessage(Handler.java:106)

        at android.os.Looper.loop(Looper.java:192)

        at android.app.ActivityThread.main(ActivityThread.java:6840)

        at java.lang.reflect.Method.invoke(Native Method)

        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

     Caused by: android.view.InflateException: Binary XML file line #38: Binary XML file line #38: Error inflating class

     Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class

     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:656)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:835)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:775)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:908)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:495)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:380)

        at android.view.View.inflate(View.java:23469)

        at net.qiujuer.italker.common.widget.AudioRecordView.init(AudioRecordView.java:75)

        at net.qiujuer.italker.common.widget.AudioRecordView.(AudioRecordView.java:66)

        at java.lang.reflect.Constructor.newInstance0(Native Method)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)

        at android.view.LayoutInflater.createView(LayoutInflater.java:656)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:835)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:775)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:908)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1040)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:904)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:521)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)

        at net.qiujuer.italker.common.app.Fragment.onCreateView(Fragment.java:41)

        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)

        at androidx.fragment.app.FragmentManagerImpl.ensureInflatedFragmentView(FragmentManagerImpl.java:1138)

2020-02-19 17:19:11.498 20612-20612/net.qiujuer.italker.push E/AndroidRuntime:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:851)

        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1133)

        at androidx.fragment.app.FragmentManagerImpl.addFragment(FragmentManagerImpl.java:1393)

        at androidx.fragment.app.FragmentManagerImpl.onCreateView(FragmentManagerImpl.java:3205)

        at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:192)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:817)

        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:775)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:908)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.rInflate(LayoutInflater.java:911)

        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:869)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:521)

        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)

        at net.qiujuer.italker.common.app.Fragment.onCreateView(Fragment.java:41)

        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.dispatchStateChange(FragmentManagerImpl.java:2663)

        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:1340)

        at android.app.Activity.performStart(Activity.java:7145)

        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2945)

        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3060)

        at android.app.ActivityThread.-wrap11(Unknown Source:0)

        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769)

        at android.os.Handler.dispatchMessage(Handler.java:106)

        at android.os.Looper.loop(Looper.java:192)

        at android.app.ActivityThread.main(ActivityThread.java:6840)

        at java.lang.reflect.Method.invoke(Native Method)

        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)

        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

     Caused by: java.lang.NumberFormatException: For input string: "0.0dip"

        at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)

        at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)

        at java.lang.Float.parseFloat(Float.java:452)

        at android.content.res.TypedArray.getFloat(TypedArray.java:416)

        at net.qiujuer.genius.ui.widget.FloatActionButton.init(FloatActionButton.java:122)

        at net.qiujuer.genius.ui.widget.FloatActionButton.(FloatActionButton.java:81)

        at net.qiujuer.genius.ui.widget.FloatActionButton.(FloatActionButton.java:76)

        ... 67 more


http://img.mukewang.com/szimg/5e4e3545099b686200000000.jpg

报错定位到截图中的 inflate()。,加了个断点试了一下,到这里就崩了。

写回答

1回答

Qiujuer

2020-02-20

哦,这个BUG是因为AS高版本编译时的一个id和组件内部的id重复了,导致了异常。

后面进行了修正,就是升级一下Genius库的版本即可。另外后面可能还会遇到其他问题,可以看看这里:
https://github.com/qiujuer/iTalker
在这个的issues中有关于音频部分崩溃的解决方案哈。

最终代码也进行了更新的。你也可以对比最终代码。

0
1
passerbyYSQ
非常感谢!
2020-02-21
共1条回复

手把手开发完整的即时通讯App 客户端+服务端+MVP架构

客户端+服务端+MVP架构+封装思想+主流框架

1749 学习 · 872 问题

查看课程