Android failed creating starting window

简介: /***************************************************************************** * Android failed creating starting window * 声明: * 最近正在整的一个App在logcat中总是报这种异常,貌似也不影响程序的运行,但 * 每次都看到这种异常实在是难受,于是还是查点资料解决了去吧。
/*****************************************************************************
 *               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>
    

 

目录
打赏
0
0
0
0
12
分享
相关文章
Android Studio: 解决Gradle sync failed 错误
本文介绍了解决Android Studio中出现的Gradle同步失败错误的步骤,包括从`gradle-wrapper.properties`文件中获取Gradle的下载链接,手动下载Gradle压缩包,并替换默认下载路径中的临时文件,然后重新触发Android Studio的"Try Again"来完成同步。
2651 0
Android Studio: 解决Gradle sync failed 错误
解决Manifest merger failed : android:exported needs to be explicitly specified for <activity>
解决Manifest merger failed : android:exported needs to be explicitly specified for <activity>
175 1
Android Studio resource linking failed
Android Studio resource linking failed
141 1
Android面试题自定义View之Window、ViewRootImpl和View的三大流程
Android开发中,View的三大核心流程包括measure(测量)、layout(布局)和draw(绘制)。MeasureSpec类在测量过程中起到关键作用,它结合尺寸大小和模式(EXACTLY、AT_MOST、UNSPECIFIED)来指定View应如何测量。onMeasure方法用于自定义View的测量,布局阶段,ViewGroup调用onLayout确定子元素位置,而draw阶段按照特定顺序绘制背景、内容、子元素和装饰。整个流程始于ViewRootImpl的performTraversals,该方法触发测量、布局和绘制。
146 0
由" failed to run the android sdk manager"引起的一系列问题 android
由" failed to run the android sdk manager"引起的一系列问题 android
|
10月前
|
Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
Caused by: android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
115 3
|
10月前
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associate
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associate
243 2
【Bug】Android resource linking failed和error: failed linking references.
【Bug】Android resource linking failed和error: failed linking references.
使用xamarin开发Android、iOS报错failed to open directory: 系统找不到指定的文件
使用vs2019学习xamarin时,创建新程序。使用模拟器真机等测试都报错如下图错误: ![请在此添加图片描述](https://developer-private-1258344699.cos.ap-guangzhou.myqcloud.com/column/article/5877188/20231030-de8ce5fd.png?x-cos-security-token=r4KyZDEowPT0kGTL0LqE8EnwfN1Nzexadb05dcffed3939ff8d7591c528c01706nvpGSE93QwHpZM8NwhJNTZctNRQa0l3KDhEnqj8P7d8t
147 0
使用xamarin开发Android、iOS报错failed to open directory: 系统找不到指定的文件
Android Execution failed for task ‘:app:mergeDebugAssets‘. > java.nio.file.AccessDeniedException:错误
Android Execution failed for task ‘:app:mergeDebugAssets‘. > java.nio.file.AccessDeniedException:错误
199 0

热门文章

最新文章

  • 1
    Android历史版本与APK文件结构
    15
  • 2
    【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
    15
  • 3
    APP-国内主流安卓商店-应用市场-鸿蒙商店上架之必备前提·全国公安安全信息评估报告如何申请-需要安全评估报告的资料是哪些-优雅草卓伊凡全程操作
    15
  • 4
    【03】仿站技术之python技术,看完学会再也不用去购买收费工具了-修改整体页面做好安卓下载发给客户-并且开始提交网站公安备案-作为APP下载落地页文娱产品一定要备案-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    4
  • 5
    【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    2
  • 6
    Cellebrite UFED 4PC 7.71 (Windows) - Android 和 iOS 移动设备取证软件
    7
  • 7
    escrcpy:【技术党必看】Android开发,Escrcpy 让你无线投屏新体验!图形界面掌控 Android,30-120fps 超流畅!🔥
    4
  • 8
    【01】仿站技术之python技术,看完学会再也不用去购买收费工具了-用python扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-客户的麻将软件需要下载落地页并且要做搜索引擎推广-本文用python语言快速开发爬取落地页下载-优雅草卓伊凡
    2
  • 9
    即时通讯安全篇(一):正确地理解和使用Android端加密算法
    12
  • 10
    Android实战经验之Kotlin中快速实现MVI架构
    9
  • 1
    android FragmentManager 删除所有Fragment 重建
    18
  • 2
    Android实战经验之Kotlin中快速实现MVI架构
    31
  • 3
    即时通讯安全篇(一):正确地理解和使用Android端加密算法
    36
  • 4
    escrcpy:【技术党必看】Android开发,Escrcpy 让你无线投屏新体验!图形界面掌控 Android,30-120fps 超流畅!🔥
    43
  • 5
    【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
    144
  • 6
    Cellebrite UFED 4PC 7.71 (Windows) - Android 和 iOS 移动设备取证软件
    47
  • 7
    【03】仿站技术之python技术,看完学会再也不用去购买收费工具了-修改整体页面做好安卓下载发给客户-并且开始提交网站公安备案-作为APP下载落地页文娱产品一定要备案-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    59
  • 8
    Android历史版本与APK文件结构
    164
  • 9
    【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    48
  • 10
    【01】仿站技术之python技术,看完学会再也不用去购买收费工具了-用python扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-客户的麻将软件需要下载落地页并且要做搜索引擎推广-本文用python语言快速开发爬取落地页下载-优雅草卓伊凡
    42
  • AI助理

    你好,我是AI助理

    可以解答问题、推荐解决方案等