android 4.0.3 手机崩溃,为什么?
最近我在android4.0.3平台上移植了一个电话项目,当拨打电话时,电话在通话屏幕中崩溃。日志如下:
E/AndroidRuntime( 1622): FATAL EXCEPTION: main
E/AndroidRuntime( 1622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.phone/com.android.phone.InCallScreen}: android.view.InflateException: Binary XML file line #35: Error inflating class <unknown>
E/AndroidRuntime( 1622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime( 1622): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime( 1622): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime( 1622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime( 1622): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1622): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1622): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 1622): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1622): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 1622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 1622): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1622): Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class <unknown>
E/AndroidRuntime( 1622): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
E/AndroidRuntime( 1622): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:823)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.rInflate(LayoutInflater.java:729)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime( 1622): at android.view.ViewStub.inflate(ViewStub.java:232)
E/AndroidRuntime( 1622): at com.android.phone.InCallScreen.initInCallScreen(InCallScreen.java:1223)
E/AndroidRuntime( 1622): at com.android.phone.InCallScreen.onCreate(InCallScreen.java:514)
E/AndroidRuntime( 1622): at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime( 1622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime( 1622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime( 1622): ... 11 more
E/AndroidRuntime( 1622): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 1622): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 1622): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
E/AndroidRuntime( 1622): ... 26 more
E/AndroidRuntime( 1622): Caused by: java.lang.StackOverflowError
E/AndroidRuntime( 1622): at android.util.SparseArray.get(SparseArray.java:73)
E/AndroidRuntime( 1622): at android.content.res.StringBlock.get(StringBlock.java:69)
E/AndroidRuntime( 1622): at android.content.res.AssetManager.getResourceValue(AssetManager.java:201)
E/AndroidRuntime( 1622): at android.content.res.Resources.getValue(Resources.java:1015)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:663)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
E/AndroidRuntime( 1622): at android.content.res.Resources.loadDrawable(Resources.java:1922)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:664)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
E/AndroidRuntime( 1622): at android.content.res.Resources.loadDrawable(Resources.java:1922)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:664)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
E/AndroidRuntime( 1622): at android.content.res.Resources.loadDrawable(Resources.java:1922)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:664)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at andro
W/ActivityManager( 1348): Force finishing activity com.android.phone/.InCallScreen
谢谢。 错误 xml 是: *dtmf_twelve_key_dialer_view.xml第35行:android:visibility =“消失”*
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Onscreen in-call DTMF dialpad. This element contains the grid of
DTMF buttons (dialpad.xml) along with a TextView showing
the digits you've typed.
When the user presses the "Dialpad" button, this UI appears in the
upper part of the in-call screen, covering up the "call card" area.
The regular in-call controls (i.e. the InCallTouchUi widget) are
still visible at the lower part of the screen.
This layout is inflated in place of dtmf_twelve_key_dialer_stub
in incall_touch_ui.xml. -->
<com.android.phone.DTMFTwelveKeyDialerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dtmf_twelve_key_dialer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="1dip"
android:visibility="gone"
>
<!-- Display of the digits you've typed so far.
This widget appears completely non-interactive to the user: you
can't edit or "hit backspace" since these are DTMF tones you've
already sent over the network. But it's still an EditText rather
than a TextView because it needs to receive key events from a
hard keyboard, if present (see mDialerKeyListener). -->
<EditText
android:id="@+id/dtmfDialerField"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:singleLine="true"
android:scrollHorizontally="true"
android:textSize="24sp"
android:gravity="center"
android:freezesText="true"
android:background="@null"
android:textColor="@color/dtmf_dialer_display_text"
android:focusableInTouchMode="false"
android:clickable="false"/>
<!-- The dialpad itself -->
<include layout="@layout/dialpad" />
</com.android.phone.DTMFTwelveKeyDialerView>
Recently I porting a phone project at platrom android4.0.3, when dialed a call, phone crash in incallscreen. The log as following:
E/AndroidRuntime( 1622): FATAL EXCEPTION: main
E/AndroidRuntime( 1622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.phone/com.android.phone.InCallScreen}: android.view.InflateException: Binary XML file line #35: Error inflating class <unknown>
E/AndroidRuntime( 1622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime( 1622): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime( 1622): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime( 1622): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime( 1622): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1622): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1622): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 1622): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1622): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1622): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 1622): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 1622): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1622): Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class <unknown>
E/AndroidRuntime( 1622): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
E/AndroidRuntime( 1622): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:823)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.rInflate(LayoutInflater.java:729)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime( 1622): at android.view.ViewStub.inflate(ViewStub.java:232)
E/AndroidRuntime( 1622): at com.android.phone.InCallScreen.initInCallScreen(InCallScreen.java:1223)
E/AndroidRuntime( 1622): at com.android.phone.InCallScreen.onCreate(InCallScreen.java:514)
E/AndroidRuntime( 1622): at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime( 1622): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime( 1622): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime( 1622): ... 11 more
E/AndroidRuntime( 1622): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 1622): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 1622): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime( 1622): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
E/AndroidRuntime( 1622): ... 26 more
E/AndroidRuntime( 1622): Caused by: java.lang.StackOverflowError
E/AndroidRuntime( 1622): at android.util.SparseArray.get(SparseArray.java:73)
E/AndroidRuntime( 1622): at android.content.res.StringBlock.get(StringBlock.java:69)
E/AndroidRuntime( 1622): at android.content.res.AssetManager.getResourceValue(AssetManager.java:201)
E/AndroidRuntime( 1622): at android.content.res.Resources.getValue(Resources.java:1015)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:663)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
E/AndroidRuntime( 1622): at android.content.res.Resources.loadDrawable(Resources.java:1922)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:664)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
E/AndroidRuntime( 1622): at android.content.res.Resources.loadDrawable(Resources.java:1922)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:664)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:867)
E/AndroidRuntime( 1622): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:804)
E/AndroidRuntime( 1622): at android.content.res.Resources.loadDrawable(Resources.java:1922)
E/AndroidRuntime( 1622): at android.content.res.Resources.getDrawable(Resources.java:664)
E/AndroidRuntime( 1622): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
E/AndroidRuntime( 1622): at andro
W/ActivityManager( 1348): Force finishing activity com.android.phone/.InCallScreen
thanks.
The erreo xml is:
*dtmf_twelve_key_dialer_view.xml line35: android:visibility="gone"*
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Onscreen in-call DTMF dialpad. This element contains the grid of
DTMF buttons (dialpad.xml) along with a TextView showing
the digits you've typed.
When the user presses the "Dialpad" button, this UI appears in the
upper part of the in-call screen, covering up the "call card" area.
The regular in-call controls (i.e. the InCallTouchUi widget) are
still visible at the lower part of the screen.
This layout is inflated in place of dtmf_twelve_key_dialer_stub
in incall_touch_ui.xml. -->
<com.android.phone.DTMFTwelveKeyDialerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dtmf_twelve_key_dialer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="1dip"
android:visibility="gone"
>
<!-- Display of the digits you've typed so far.
This widget appears completely non-interactive to the user: you
can't edit or "hit backspace" since these are DTMF tones you've
already sent over the network. But it's still an EditText rather
than a TextView because it needs to receive key events from a
hard keyboard, if present (see mDialerKeyListener). -->
<EditText
android:id="@+id/dtmfDialerField"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:singleLine="true"
android:scrollHorizontally="true"
android:textSize="24sp"
android:gravity="center"
android:freezesText="true"
android:background="@null"
android:textColor="@color/dtmf_dialer_display_text"
android:focusableInTouchMode="false"
android:clickable="false"/>
<!-- The dialpad itself -->
<include layout="@layout/dialpad" />
</com.android.phone.DTMFTwelveKeyDialerView>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论