You need to use a Theme.AppCompat theme (or descendant) with this activity

SzabolcsLibaSzabolcsLiba USMember ✭✭
edited November 2018 in Xamarin.Android

Hello!

I tried to Release my Xamarin.Android project after that i got the following error message:

  • You need to use a Theme.AppCompat theme (or descendant) with this activity

Everything is worked fine while i used the application in debug mode.
I saw a lot of conversation of this error, but i can't solve it yet.

In my mainactivity:

[Activity(Label = "***.Android", Theme = "@style/MyAppTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)]
 public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="***.***" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0">
    <uses-sdk android:minSdkVersion="22" android:targetSdkVersion="26" />
    <application android:allowBackup="true" android:label="@string/app_name" android:largeHeap="true" android:hardwareAccelerated="false" android:icon="@drawable/icon">
  </application>
</manifest>

Styles.xml:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:colorActivatedHighlight">@android:color/transparent</item>
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="windowActionModeOverlay">true</item>
  </style>
</resources>

Please help!
Sorry for bad English and thanks for the answers.

Best Answer

  • SzabolcsLibaSzabolcsLiba US ✭✭
    Accepted Answer

    Sorry it solved:
    I changed the parent from parent="Theme.AppCompat.Light.DarkActionBar" to parent="Theme.AppCompat" after that i cleaned, deleted bin and obj folders and rebuild the Android project.

Answers

  • SzabolcsLibaSzabolcsLiba USMember ✭✭
    Accepted Answer

    Sorry it solved:
    I changed the parent from parent="Theme.AppCompat.Light.DarkActionBar" to parent="Theme.AppCompat" after that i cleaned, deleted bin and obj folders and rebuild the Android project.

Sign In or Register to comment.