user5313398
user5313398

Reputation: 753

Xamarin No resource found that matches the given name (at 'theme' with value '@style/DesignTheme'). App1.Droid

I am new to Xamarin. So I started a shared project. Then I google some link to add material design and did the following.

  1. I created the styles.xml.(I dont understand why the resources/value folder is not seen in visual studio but when I manually go the directory I could see so I created manually in there with the following content.

    <?xml version="1.0" encoding="UTF-8" ? >
    <resources>
        <style name="DesignTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <item name="windowNoTitle" >true </item >
            <item name="windowActionBar" >false </item >
            <item name="colorPrimary" >@color/primary </item >
            <item name="colorPrimaryDark" >@color/primary_dark </item >
            <item name="colorAccent" >@color/accent </item > 
        </style >
    </resources >
    
  2. Next I change the manifest as below.I added this android:theme="@style/DesignTheme"

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-sdk android:minSdkVersion="15" />
        <application android:label="App1.Droid" android:theme="@style/DesignTheme"></application>
    </manifest>
    
  3. I just tried to build and I got this error No resource found that matches the given name (at 'theme' with value '@style/DesignTheme'). but the manifest shows this now. Why is it different then in step 2?

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="App1.Droid">
        <!--suppress UsesMinSdkAttributes-->
        <uses-sdk android:minSdkVersion="15" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <application android:label="App1.Droid" android:theme="@style/DesignTheme" android:name="android.app.Application" android:allowBackup="true" android:icon="@drawable/icon" android:debuggable="true">
            <activity android:configChanges="orientation|screenSize" android:icon="@drawable/icon" android:label="App1" android:name="md50170a25da682dd459b9251c65ebe3a7a.MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="2147483647" android:authorities="App1.Droid.mono.MonoRuntimeProvider.__mono_init__" />
            <!--suppress ExportedReceiver-->
            <receiver android:name="mono.android.Seppuku">
                <intent-filter>
                    <action android:name="mono.android.intent.action.SEPPUKU" />
                    <category android:name="mono.android.intent.category.SEPPUKU.App1.Droid" />
                </intent-filter>
            </receiver>
        </application>
    </manifest>
    

The full error is .

No resource found that matches the given name (at 'theme' with value '@style/DesignTheme'). App1.Droid C:\Users\ns\Documents\Visual Studio 2015\Projects\App1\App1\App1.Droid\obj\Debug\android\manifest\AndroidManifest.xml

Under the Nuget Package Manager I can see the installed list shows this Xamarin.Android.Support.Design is installed for version v24.2.1

Upvotes: 0

Views: 1148

Answers (1)

M.Rahmani
M.Rahmani

Reputation: 11

in MainActivity, in

[Activity(Label = "appName", ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait, MainLauncher = true)]

Remove them.

Upvotes: 0

Related Questions