[英]Android Studio is giving me AAPT error on uneditable XML files
我正在尝试在 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 > values > 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.