找不到资源样式/Theme.Base

时间:2019-01-18 11:20:48

标签: android

当我尝试在设备中构建android代码时,我在android studio中收到此错误?

  

错误:找不到资源样式/Theme.Base(又名com.example.android.bluetoothlegatt:style / Theme.Base)。   错误:链接引用失败。

2 个答案:

答案 0 :(得分:0)

在清单文件检查代码中使用AppTheme,然后看到我将在其中注释的行

     <application
        android:name=".application.MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:roundIcon="@drawable/app_icon"
        android:supportsRtl="true"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:theme="@style/AppTheme">  // here

检查样式必须是这样的:

<style name="AppTheme" parent="Theme.AppCompat.Light">
       ....customize Theme....
</style>

和Appcompat库应该更新:

implementation 'com.android.support:appcompat-v7:28.0.0'

并也检查此link

答案 1 :(得分:0)

可以更改:

<groupId>ru.evgeniyosipov.facshop</groupId>
<artifactId>facshop</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>facshop</name>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.exec.plugin.version>1.4.0</maven.exec.plugin.version>
    <integration.container.id>glassfish4x</integration.container.id>
    <glassfish.home>${glassfish.home.prefix}/glassfish4</glassfish.home>
</properties>

<profiles>
    <profile>
        <id>windows</id>
        <activation>
            <os>
                <family>windows</family>
            </os>
        </activation>
        <properties>
            <glassfish.home.prefix>c:/</glassfish.home.prefix>
            <glassfish.executables.suffix>.bat</glassfish.executables.suffix>
        </properties>
    </profile>
    <profile>
        <id>unix</id>
        <activation>
            <os>
                <family>unix</family>
            </os>
        </activation>
        <properties>
            <glassfish.home.prefix>${user.home}</glassfish.home.prefix>
            <glassfish.executables.suffix />
        </properties>
    </profile>
</profiles>

<modules>
    <module>facshop-events</module>
    <module>facshop-entities</module>
    <module>facshop-resources</module>
    <module>facshop-payment</module>
    <module>facshop-store</module>
    <module>facshop-shipment</module>
</modules>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.14</version>
            <executions>
                <execution>
                    <id>Deploy</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>redeploy</goal>
                    </goals>
                    <configuration>
                        <container>
                            <containerId>${integration.container.id}</containerId>
                            <type>installed</type>
                            <home>${glassfish.home}</home>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <home>${glassfish.home}/glassfish/domains</home>
                            <properties>
                                <cargo.glassfish.domain.name>domain1</cargo.glassfish.domain.name>
                                <cargo.glassfish.admin.port>4848</cargo.glassfish.admin.port>
                                <cargo.remote.username>admin</cargo.remote.username>
                                <cargo.remote.password></cargo.remote.password>
                            </properties>
                        </configuration>
                    </configuration>
                </execution>
            </executions>        
        </plugin>                  
    </plugins>
</build>

style name="AppBaseTheme" 

在您的styles.xml文件中。或更改:

style name="AppTheme" 

android:theme="@style/AppTheme"

在清单应用程序标记中。

两者应该相同。基本上,您的应用正在尝试使用不存在的AppBaseTheme。