Error parsing XML: unclosed token (APT0000)

axbeitaxbeit Member ✭✭
edited December 2018 in Xamarin.Forms

Hey there. I get that error I have wrote in the title. Does anyone know what is wrong and/or how to fix it? iOS works fine. Android does not work.

App.xaml.cs:

using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace BookCodeSL
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();

            MainPage = new PlatInfoSap1();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}

PlatInfoSap1.xaml.cs:

using System;
using System.Collections.Generic;

using Xamarin.Forms;

#if __IOS__
using UIKit;

#elif __ANDROID__
using Android.OS;

#endif

namespace BookCodeSL
{
    public partial class PlatInfoSap1 : ContentPage
    {
        public PlatInfoSap1()
        {
            InitializeComponent();

#if __IOS__

            UIDevice.device = new UIDevice();
            modelLabel.Text = device.Model.ToString();
            versionLabel.Text = String.Format("{0} {1}", device.SystemName, device.SystemVersion);

#elif __ANDROID__
            modelLabel.Text = String.Format("{0} {1}", Build.Manufacturer, Build.Model);
            versionLabel.Text = Build.VERSION.Release.ToString();

#endif
        }
    }
}

PlatInfoSap1.xaml:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="BookCodeSL.PlatInfoSap1">


    <StackLayout Padding="20">
        <StackLayout VerticalOptions="CenterAndExpand">
            <Label Text="Device Model:"/>

            <ContentView Padding="50,0,0,0">
                <Label x:Name="modelLabel"
                       FontSize="Large"
                       FontAttributes="Bold"/>
            </ContentView>
        </StackLayout>

        <StackLayout VerticalOptions="CenterAndExpand">
            <Label Text="Operating System Version:"/>

            <ContentView Padding="50,0,0,0">
                <Label x:Name="versionLabel"
                       FontSize="Large"
                       FontAttributes="Bold"/>
            </ContentView>
        </StackLayout>
    </StackLayout>

</ContentPage>

abc_primary_text_disable_only_material_light.xml - This is where "Error parsing XML:unclosed token (APT0000)" can be read:

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
Tagged:

Best Answer

Answers

  • axbeitaxbeit Member ✭✭

    Someone told me that I have to change abc_primary_text_disable_only_material_light.xml to:

    <?xml version="1.0" encoding="utf-8"?>
    <!-- Copyright (C) 2014 The Android Open Source Project
         Licensed under the Apache License, Version 2.0 (the "License");
         you may not use this file except in compliance with the License.
         You may obtain a copy of the License at
              http://www.apache.org/licenses/LICENSE-2.0
         Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS,
         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         See the License for the specific language governing permissions and
         limitations under the License.
    -->
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_enabled="false" android:color="@color/bright_foreground_disabled_material_light"/>
        <item android:color="@color/bright_foreground_material_light"/>
    </selector>
    

    But that did not work out. Does anyone know what else I could try?

Sign In or Register to comment.