科尔多瓦找不到主题.AppCompat.Light [英] Cordova fails to find Theme.AppCompat.Light

查看:94
本文介绍了科尔多瓦找不到主题.AppCompat.Light的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个简单的Cordova项目,该项目应该在Android上显示启动画面.要利用整个屏幕,我需要通过扩展Theme.AppCompat.Light来摆脱状态栏. 因此,我设置了这个styles.xml文件,并将其放入Cordova项目的根文件夹中.

I've set up a simple Cordova project which should display a splashscreen on Android. To utilize the whole screen I need to get rid of the statusbar by extending Theme.AppCompat.Light. So I set up this styles.xml file and put it into the root folder of the Cordova project.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Full" parent="@style/Theme.AppCompat.Light">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>
</resources>

Cordova的config.xml文件是这样的:

Cordova's config.xml file is like this:

    <?xml version='1.0' encoding='utf-8'?>
<widget id="com.domain.test" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Test</name>
    <description>
        Just a test
    </description>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <preference name="Fullscreen" value="true" />
    <preference name="Orientation" value="landscape" />
    <splash src="res/screen/android/splashScreen.png" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="mdpi" src="res/icon/android/mdpi.png" />
        <icon density="hdpi" src="res/icon/android/hdpi.png" />
        <icon density="xhdpi" src="res/icon/android/xhdpi.png" />
        <icon density="xxhdpi" src="res/icon/android/xxhdpi.png" />
        <icon density="xxxhdpi" src="res/icon/android/xxxhdpi.png" />
        <resource-file src="styles.xml" target="app/src/main/res/values/styles.xml" />
    </platform>
    <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
        <activity android:label="@string/app_name" android:name=".ActivityName" android:theme="@style/Full" />
    </edit-config>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-fullscreen" spec="^1.2.0" />
    <engine name="android" spec="~7.1.4" />
</widget>

如果我尝试编译项目,则会出现以下错误:

If I try to compile the project I get these errors:

失败:构建失败,发生异常.

出了什么问题: 任务':app:processDebugResources'的执行失败. 无法执行aapt

What went wrong: Execution failed for task ':app:processDebugResources'. Failed to execute aapt

1秒内失败 cmd:命令失败,退出代码为1,错误输出:

BUILD FAILED in 1s cmd: Command failed with exit code 1 Error output:

错误:找不到资源样式/Theme.AppCompat.Light(又名com.domain.test:样式/Theme.AppCompat.Light).

错误:链接引用失败.

推荐答案

您可能没有将AppCompat库添加到项目中.您是否将以下行添加到配置文件中?

You possibly didn't add the AppCompat library to your project. Did you add the following line to your configuration files?

<framework src="com.android.support:appcompat-v7:+"/>

在此处了解有关框架的更多信息: https://cordova. apache.org/docs/en/latest/plugin_ref/spec.html

Read more about the frameworks here: https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html

这篇关于科尔多瓦找不到主题.AppCompat.Light的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆