Android failed creating starting window

/*****************************************************************************
 *               Android failed creating starting window
 * 声明:
 *     最近正在整的一个App在logcat中总是报这种异常,貌似也不影响程序的运行,但
 * 每次都看到这种异常实在是难受,于是还是查点资料解决了去吧。
 *
 *                                           2016-5-5 深圳 南山平山村 曾剑锋
 ****************************************************************************/

一、参考文章:
    已解决_Android_Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (
        http://blog.csdn.net/tianshanaoxue/article/details/16806283

二、error:
    W/WindowManager( 2520): Token{4116dcf8 ActivityRecord{410d1f00 u0 com.aplex.ethernet/.MainActivity}} failed creating starting window
    W/WindowManager( 2520): android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>
    W/WindowManager( 2520):         at android.view.LayoutInflater.createView(LayoutInflater.java:613)
    W/WindowManager( 2520):         at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    W/WindowManager( 2520):         at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
    W/WindowManager( 2520):         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
    W/WindowManager( 2520):         at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
    W/WindowManager( 2520):         at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    W/WindowManager( 2520):         at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    W/WindowManager( 2520):         at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
    W/WindowManager( 2520):         at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2812)
    W/WindowManager( 2520):         at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2875)
    W/WindowManager( 2520):         at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1568)
    W/WindowManager( 2520):         at com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:1591)
    W/WindowManager( 2520):         at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:7450)
    W/WindowManager( 2520):         at android.os.Handler.dispatchMessage(Handler.java:99)
    W/WindowManager( 2520):         at android.os.Looper.loop(Looper.java:137)
    W/WindowManager( 2520):         at android.os.HandlerThread.run(HandlerThread.java:60)
    W/WindowManager( 2520): Caused by: java.lang.reflect.InvocationTargetException
    W/WindowManager( 2520):         at java.lang.reflect.Constructor.constructNative(Native Method)
    W/WindowManager( 2520):         at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    W/WindowManager( 2520):         at android.view.LayoutInflater.createView(LayoutInflater.java:587)
    W/WindowManager( 2520):         ... 15 more
    W/WindowManager( 2520): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x1010059 a=-1}
    W/WindowManager( 2520):         at android.content.res.Resources.loadDrawable(Resources.java:1927)
    W/WindowManager( 2520):         at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
    W/WindowManager( 2520):         at android.widget.FrameLayout.<init>(FrameLayout.java:109)
    W/WindowManager( 2520):         at android.widget.FrameLayout.<init>(FrameLayout.java:97)
    W/WindowManager( 2520):         ... 18 more

三、解决办法:
    1. cat AndroidManifest.xml
        ......
        <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/theme" >
        ......
    2. cat res/values/styles.xml
        <resources>

            <!--
                Base application theme, dependent on API level. This theme is replaced
                by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
            -->
            <style name="AppBaseTheme" parent="android:Theme.Light">
                <!--
                    Theme customizations available in newer API levels can go in
                    res/values-vXX/styles.xml, while customizations related to
                    backward-compatibility can go here.
                -->
            </style>

            <!-- Application theme. -->
            <style name="AppTheme" parent="AppBaseTheme">
                <!-- All customizations that are NOT specific to a particular API-level can go here. -->
            </style>

            <style name="style_quicksettings_category_text">
                <item name="android:textColor">@color/qs_text_title</item>
                <item name="android:fontFamily">sans-serif</item>
            </style>

        </resources>
    3. cat res/values/themes.xml
        <?xml version="1.0" encoding="utf-8"?>
        <resources>
            <style name="theme">
                <item name="android:windowNoTitle">true</item>
                <item name="android:windowFullscreen">?android:windowNoTitle</item>
                <item name="android:windowBackground">@android:drawable/screen_background_dark</item>
                <item name="android:windowFrame">@null</item>
                <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
            </style>
        </resources>
    4. 修改为如下:
        cat res/values/themes.xml
            <?xml version="1.0" encoding="utf-8"?>
            <resources>
                <style name="theme" parent="AppTheme">
                    <item name="android:windowNoTitle">true</item>
                    <item name="android:windowFullscreen">?android:windowNoTitle</item>
                    <item name="android:windowBackground">@android:drawable/screen_background_dark</item>
                    <item name="android:windowFrame">@null</item>
                    <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>
                </style>
            </resources>
    
时间: 2024-11-05 02:00:34

Android failed creating starting window的相关文章

Android Starting Window(Preview Window)

当打开一个Activity时,如果这个Activity所属的应用还没有在运行,系统会为这个Activity所属的应用创建一个进程,但进程的创建与初始化都需要时间,在这个动作完成之前系统要做什么呢?如果没有任何反应的话,如果程序初始化的时间很长,用户可能还以为没有点到相应的位置.但此时所启动的程序还没初始化完,既无法显示程序,又不能停在原处不做任何动作,怎么办?这就有了Starting Window的概念,也可以称之为Preview Window. Starting Window就是一个用于在应用

Android窗口管理服务WindowManagerService显示Activity组件的启动窗口(Starting Window)的过程分析

文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8577789 在Android系统中,Activity组件在启动之后,并且在它的窗口显示出来之前,可以显示一个启动窗口.这个启动窗口可以看作是 Activity组件的预览窗口,是由WindowManagerService服务统一管理的,即由WindowManagerService服务负责 启动和结束.在本文中,我们就详细分析WindowManag

如何下载Android源码(window和Linux)

文章参照来源:http://source.android.com/source/downloading.html 一.window平台 关于在window平台下载Android源码,网上一般使用的是直接用git来下载. 比如: http://wenku.baidu.com/view/a4f5f922482fb4daa58d4bb5.html http://hendyyou.iteye.com/blog/1147738 这种方式最严重的问题是,对源码只能分块(git块)进行下载,而且块数很多.关键

Android SDK安装时出错“android Failed to rename directory”的解决方法

Android SDK安装时出错"android Failed to rename directory"的解决的方法 安装Android SDK时遇到Failed to rename directory E:\Java\Android SDK\android-sdk_r06-windows\android-sdk-windows\tools to E:\Java\Android SDK\android-sdk_r06-windows\android-sdk-windows\temp\T

Android DEV : Show a window on Baidu Map

      周末同学说想弄个基于Baidu地图的应用来, 于是就开始研究这个SDK来. 其中应用有个需求, 需要点击地图上的标记时, 显示一组按钮. 于是按照常规的作法失业了InfoWindow, 如下. //panel is a view, some buttons in it. final InfoWindow iw = new InfoWindow(panel, marker.getPosition(), null); //getMap() return BaiduMap activity

Android排错:has leaked window com.android.internal.policy.impl.PhoneWindow$ that was originally added here

原文地址: http://www.cnblogs.com/royenhome/archive/2011/05/20/2051879.html 异常场景: 经常在应用中需要处理一些耗时的工作,诸如读取大文件.访问网络资源等.为了避免因程序假死而带来的糟糕用户体验,通常我们可以通过线程+Handler或者Android提供的AsyncTask来解决该问题,并一般以ProgressDialog等提示性控件来告知用户当前的程序进度.而标题中描述的异常则会常常出现在这样的场景中,并且往往掩盖了导致异常的真

应用商城 下载apk 安装包解析错误 没有权限 Permission denied Android - failed to open zip archive

1.错误提示: 03-31 16:48:43.740: INFO/ActivityManager(59): Start proc com.android.packageinstaller for activity com.android.packageinstaller/.PackageInstallerActivity: pid=620 uid=10026 gids={} 03-31 16:48:44.749: WARN/zipro(620): Unable to open zip '/dat

Android进阶笔记08:Android 中Activity、Window和View之间的关系

1. Android 中Activity.Window和View之间的关系(比喻): Activity像一个工匠(控制单元),Window像窗户(承载模型),View像窗花(显示视图) LayoutInflater像剪刀,Xml配置像窗花图纸.  2. 详解:       Activity是Android应用程序的载体,允许用户在其上创建一个用户界面,并提供用户处理事件的API,如onKeyEvent, onTouchEvent等. 并维护应用程序的生命周期.Activity本身是个庞大的载体,

ORA-00444: background process DBRM failed while starting

SQL> startup 报错:ORA-00444: background process DBRM failed while startingORA-00020:maximum number of processes () exceeded 解决:startup pfile= FILENAME 其中FILENAME为:$ORACLE_BASE/admin/数据库名称/pfile目录下的init.ora.052015182150形式的文件例如:startup pfile=/opt/oracle/