In Xamarin Forms Android run, what is this "error APT1000: Found tag id where item is expected"?

Shantimohan Elchuri 721 Reputation points
2021-04-09T18:09:15.88+00:00

I am getting this error in a Xamarin.Forms' Android project when run.

Emulator pixel_3a_xl_q_10_0_-_api_29 is running.
1>E:\XPA\my_solution\my_project\my_project.Android\obj\Debug\100\lp\68\jl\res\values\values.xml(4): error APT1000: Found tag id where item is expected

The contents of that file are:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<id name="view_tree_saved_state_registry_owner"/>
</resources>

I don't find this file in another project that was also targeting Android 10.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,380 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,716 Reputation points Microsoft External Staff
    2021-04-12T07:05:12.167+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    You can try to enable aapt2 on your Android project, then Clean and rebuild your project. Just as follows:

    86762-image.png

    Update

    I found there are two application tags in your AndroidManifest.xml file, try to remove one.
    When I changed your code into the following code, it could run properly on my device.
    The whole AndroidManifest.xml is :

        <?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="com.esmsmartsolutions.ToDoPlus" android:installLocation="auto">  
    	<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />  
    <application android:label="ToDoPlus" android:theme="@style/MainTheme"></application>  
    	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  
    	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />  
    	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
    	<uses-permission android:name="android.permission.READ_CONTACTS" />  
    	<uses-permission android:name="android.permission.CALL_PHONE" />  
    	<uses-permission android:name="android.permission.INTERNET" />  
    	<!--<application android:label="ToDoPlus">  
    		<activity android:name="microsoft.identity.client.BrowserTabActivity">  
    			<intent-filter>  
    				<action android:name="android.intent.action.VIEW" />  
    				<category android:name="android.intent.category.DEFAULT" />  
    				<category android:name="android.intent.category.BROWSABLE" />  
    				<data android:scheme="msauth" android:host="com.esmsmartsolutions.ToDoPlus" />  
    			</intent-filter>  
    		</activity>  
    	</application>-->  
    </manifest>  
    

    The result is:

    94424-image.png

    Note:I noticed you haven't include some classes into your app( Models and Services).

    Best Regards,

    Jessie Zhang

    ---
    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.