安卓工作室在不可编辑的XML文件上给了我AAPT错误



我正试图在android studio中设置OpenCV,但每当我试图构建我的项目时,我都会收到这个错误

/home/oliver/AndroidStudioProjects/Opencvreal/app/build/intermediates
/packaged_manifests/debug/AndroidManifest.xml:33: AAPT: error: 
resource style/AppTheme (aka com.example.opencvreal:style/AppTheme) not found.

错误在于生成的XML文件,据我所知,该文件是不可编辑的。以下是主要的和生成的XML文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="opencv.codeonion.com.opencv_test">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<activity
android:name=".MainActivity_show_camera"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens   android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
</manifest>

应用程序中>main>res>值>styles.xml确保style-name=";AppTheme"就在那里。如果已经在那里,那么清理并重建你的项目,希望这会起作用。

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

最新更新