Binary XML file line #1: Error inflating class uses-permission

EricGEricG GBMember
edited March 2015 in Xamarin.Android

Does anyone know why i am getting the error above when i run a piece of code to check if bluetooth is enabled in an android device?
The error occurs under 'SetContentView (Resource.Layout.Main);'

here is my axml file

<?xml version="1.0" encoding="utf-8"?>




</LinearLayout

Answers

  • EricGEricG GBMember
    edited March 2015


    Seems parts of my xml file are not visible but its basically a linear layout with on button and the two lines above included to access bluetooth

  • CheesebaronCheesebaron DKInsider, University mod

    Paste the AXML code, mark it, and press the C button in the editor.

  • EricGEricG GBMember
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <permission
            android:name="android.permission.BLUETOOTH"
            android:label="BLUETOOTH" />
        <permission
            android:name="android.permission.BLUETOOTH_ADMIN" />
        <uses-permission
            android:name="android.permission.BLUETOOTH" />
        <uses-permission
            android:name="android.permission.BLUETOOTH_ADMIN" />
        <Button
            android:id="@+id/myButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Blue" />
    </LinearLayout>
    
  • EricGEricG GBMember

    Thanks for the hint Cheesebaron, Could you help me withe the error, perhaps i havent used the permissions correctly ?

  • EricGEricG GBMember

    Oh i just fixed the error.
    Instead of using permissions in axml manifest i just included the permissions in Xamarin IDE as follows;
    Project-project options-Android application-Required permissions.
    i just tiked bluetooth and bluetooth admin under required permisions

Sign In or Register to comment.