Search code examples
androidtensorflowobject-detection

Error:No resource found that matches the given name (at 'theme' with value '@style/MaterialTheme')


I am trying to develop an object detection app in an android studio but it gives me an error. the error is in this line android:theme="@style/MaterialTheme"

manifest.xml

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="23" />

    <application android:allowBackup="true"
        android:debuggable="true"
        android:label="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:theme="@style/MaterialTheme">

        <activity android:name="org.tensorflow.demo.ClassifierActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/activity_name_classification">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="org.tensorflow.demo.DetectorActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/activity_name_detection">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="org.tensorflow.demo.StylizeActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/activity_name_stylize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest 

Solution

  • Just to give an answer which might be helpful to others coming on the question later. If you don't need any custom theme, then you can remove the attribute. Else create a style.xml if it doesn't already exist inside res/values and check if that particular <style></style> resource exists or not. If not, then you can create one. Hope this helps.