解析XML错误在Android Studio中发生

huangapple go评论91阅读模式
英文:

Failed to parse XML error in android studio

问题

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:tools="http://schemas.android.com/tools"
  4. package="com.tz.rebuspuzzles"
  5. >
  6. <uses-permission android:name="android.permission.INTERNET" />
  7. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  8. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  9. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  10. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  11. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  12. <uses-feature
  13. android:name="android.hardware.location"
  14. android:required="false" />
  15. <uses-feature
  16. android:name="android.hardware.location.gps"
  17. android:required="false" />
  18. <uses-feature
  19. android:name="android.hardware.location.network"
  20. android:required="false" />
  21. <application
  22. tools:replace="android:allowBackup"
  23. android:name=".MyApplication"
  24. android:allowBackup="true"
  25. android:icon="@mipmap/app_icon"
  26. android:label="@string/app_name"
  27. android:supportsRtl="true"
  28. android:theme="@style/AppTheme"
  29. tools:ignore="ExtraText"
  30. android:usesCleartextTraffic="true"
  31. tools:targetApi="m">
  32. <meta-data
  33. android:name="com.google.android.gms.ads.APPLICATION_ID"
  34. android:value="ca-app-pub-4933880264960213~2855079080"/>
  35. <meta-data android:name="applovin.sdk.key"
  36. android:value="1p2moVFG0VBUQ_vqgpyJZ18b-8sIuVr9viNxfB8f31_VilypJa8OMgUyHaLy-f4ngCuKAZun_1Gp358RTB1B99" />
  37. <activity android:name=".MainActivity"
  38. android:screenOrientation="portrait"
  39. android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
  40. android:configChanges="orientation|keyboardHidden|screenSize"
  41. >
  42. <intent-filter>
  43. <action android:name="android.intent.action.VIEW" />
  44. <category android:name="android.intent.category.DEFAULT" />
  45. <category android:name="android.intent.category.BROWSABLE" />
  46. <!--
  47. ATTENTION: This data URL was auto-generated. We recommend that you use the HTTP scheme.
  48. TODO: Change the host or pathPrefix as necessary.
  49. -->
  50. <data
  51. android:host="solveariddle.com"
  52. android:scheme="http" />
  53. </intent-filter>
  54. </activity>
  55. <activity
  56. android:name=".SecondActivity"
  57. android:screenOrientation="portrait"
  58. android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
  59. android:configChanges="orientation|keyboardHidden|screenSize" />
  60. <activity <!-- THIS IS ROW 70 FOR YOUR REFERENCE -->
  61. android:name=".SettingsActivity"
  62. android:screenOrientation="portrait" />
  63. <activity android:name=".SplashActivity"
  64. android:configChanges="orientation|keyboardHidden|screenSize"
  65. android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" >
  66. <intent-filter>
  67. <action android:name="android.intent.action.MAIN" />
  68. <category android:name="android.intent.category.LAUNCHER" />
  69. </intent-filter>
  70. </activity>
  71. <!-- Tapjoy -->
  72. <activity
  73. android:name="com.tapjoy.TJAdUnitActivity"
  74. android:configChanges="orientation|keyboardHidden|screenSize"
  75. android:hardwareAccelerated="true"
  76. android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
  77. <activity
  78. android:name="com.tapjoy.TJContentActivity"
  79. android:configChanges="orientation|keyboardHidden|screenSize"
  80. android:hardwareAccelerated="true"
  81. android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  82. <activity
  83. android:name="com.tapjoy.mraid.view.ActionHandler"
  84. android:configChanges="orientation|keyboardHidden|screenSize" />
  85. <activity
  86. android:name="com.tapjoy.mraid.view.Browser"
  87. android:configChanges="orientation|keyboardHidden|screenSize" />
  88. <!-- Tapjoy -->
  89. <!--Include the AdActivity configChanges and theme. -->
  90. <activity android:name="com.google.android.gms.ads.AdActivity"
  91. android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
  92. android:theme="@android:style/Theme.Translucent" />
  93. <!-- This meta-data tag is required to use Google Play Services. -->
  94. <meta-data
  95. android:name="com.google.android.gms.version"
  96. android:value="@integer/google_play_services_version" />
  97. <!-- Facebook -->
  98. <provider
  99. android:name="com.facebook.FacebookContentProvider"
  100. android:authorities="com.facebook.app.FacebookContentProvider1155209377959249"
  101. android:exported="true" />
  102. <meta-data
  103. android:name="com.facebook.sdk.ApplicationId"
  104. android:value="@string/facebook_app_id" />
  105. <activity
  106. android:name="com.facebook.FacebookActivity"
  107. android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
  108. android:label="@string/app_name"
  109. android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  110. </application>
  111. </manifest>
英文:

I am finding this error in the My Manifest file in the Android studio.I am aware of the fact that this question has been asked before and the solution is to rectify the manifest file but I feel that this file doesn't have any error.(unless I have still missed something)

Failed to parse XML in C:\Users\DELL\Desktop\Android studio\AndroidStudioProjects\5.REBUS PUZZLE\RebusPuzzles\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[70,9]
Message: expected start or end tag
Affected Modules: app
Note that the [row, col]:[70,9] is not the exact number as I had this error at an earlier stage and then added few tags but the row-column number remained the same even after changes which means that[70,9] might not be the exact location of the error. But still, I have marked row number 70 in my code given below

I am trying to rectify it for several days but can't find the solution.
Any help would be appreciated
Thank you

MY AndroidManifest.XML

  1. &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  2. &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  3. xmlns:tools=&quot;http://schemas.android.com/tools&quot;
  4. package=&quot;com.tz.rebuspuzzles&quot;
  5. &gt;
  6. &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
  7. &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
  8. &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
  9. &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
  10. &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
  11. &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
  12. &lt;uses-feature
  13. android:name=&quot;android.hardware.location&quot;
  14. android:required=&quot;false&quot; /&gt;
  15. &lt;uses-feature
  16. android:name=&quot;android.hardware.location.gps&quot;
  17. android:required=&quot;false&quot; /&gt;
  18. &lt;uses-feature
  19. android:name=&quot;android.hardware.location.network&quot;
  20. android:required=&quot;false&quot; /&gt;
  21. &lt;application
  22. tools:replace=&quot;android:allowBackup&quot;
  23. android:name=&quot;.MyApplication&quot;
  24. android:allowBackup=&quot;true&quot;
  25. android:icon=&quot;@mipmap/app_icon&quot;
  26. android:label=&quot;@string/app_name&quot;
  27. android:supportsRtl=&quot;true&quot;
  28. android:theme=&quot;@style/AppTheme&quot;
  29. tools:ignore=&quot;ExtraText&quot;
  30. android:usesCleartextTraffic=&quot;true&quot;
  31. tools:targetApi=&quot;m&quot;&gt;
  32. &lt;meta-data
  33. android:name=&quot;com.google.android.gms.ads.APPLICATION_ID&quot;
  34. android:value=&quot;ca-app-pub-4933880264960213~2855079080&quot;/&gt;
  35. &lt;meta-data android:name=&quot;applovin.sdk.key&quot;
  36. android:value=&quot;1p2moVFG0VBUQ_vqgpyJZ18b-8sIuVr9viNxfB8f31_VilypJa8OMgUyHaLy-f4ngCuKAZun_1Gp358RTB1B99&quot; /&gt;
  37. &lt;activity android:name=&quot;.MainActivity&quot;
  38. android:screenOrientation=&quot;portrait&quot;
  39. android:theme=&quot;@android:style/Theme.Light.NoTitleBar.Fullscreen&quot;
  40. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
  41. &gt;
  42. &lt;intent-filter&gt;
  43. &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;
  44. &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
  45. &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;
  46. &lt;!--
  47. ATTENTION: This data URL was auto-generated. We recommend that you use the HTTP scheme.
  48. TODO: Change the host or pathPrefix as necessary.
  49. --&gt;
  50. &lt;data
  51. android:host=&quot;solveariddle.com&quot;
  52. android:scheme=&quot;http&quot; /&gt;
  53. &lt;/intent-filter&gt;
  54. &lt;/activity&gt;
  55. &lt;activity
  56. android:name=&quot;.SecondActivity&quot;
  57. android:screenOrientation=&quot;portrait&quot;
  58. android:theme=&quot;@android:style/Theme.Light.NoTitleBar.Fullscreen&quot; /&gt;
  59. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
  60. &lt;activity -----------------------&gt;THIS IS ROW 70 FOR YOUR REFERENCE
  61. android:name=&quot;.SettingsActivity&quot;
  62. android:screenOrientation=&quot;portrait&quot; /&gt;
  63. &lt;activity android:name=&quot;.SplashActivity&quot;
  64. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
  65. android:theme=&quot;@android:style/Theme.Translucent.NoTitleBar.Fullscreen&quot; &gt;
  66. &lt;intent-filter&gt;
  67. &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  68. &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
  69. &lt;/intent-filter&gt;
  70. &lt;/activity&gt;
  71. &lt;!-- Tapjoy --&gt;
  72. &lt;activity
  73. android:name=&quot;com.tapjoy.TJAdUnitActivity&quot;
  74. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
  75. android:hardwareAccelerated=&quot;true&quot;
  76. android:theme=&quot;@android:style/Theme.Translucent.NoTitleBar.Fullscreen&quot; /&gt;
  77. &lt;activity
  78. android:name=&quot;com.tapjoy.TJContentActivity&quot;
  79. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
  80. android:hardwareAccelerated=&quot;true&quot;
  81. android:theme=&quot;@android:style/Theme.Translucent.NoTitleBar&quot; /&gt;
  82. &lt;activity
  83. android:name=&quot;com.tapjoy.mraid.view.ActionHandler&quot;
  84. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot; /&gt;
  85. &lt;activity
  86. android:name=&quot;com.tapjoy.mraid.view.Browser&quot;
  87. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot; /&gt;
  88. &lt;!-- Tapjoy --&gt;
  89. &lt;!--Include the AdActivity configChanges and theme. --&gt;
  90. &lt;activity android:name=&quot;com.google.android.gms.ads.AdActivity&quot;
  91. android:configChanges=&quot;keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize&quot;
  92. android:theme=&quot;@android:style/Theme.Translucent&quot; /&gt;
  93. &lt;!-- This meta-data tag is required to use Google Play Services. --&gt;
  94. &lt;meta-data
  95. android:name=&quot;com.google.android.gms.version&quot;
  96. android:value=&quot;@integer/google_play_services_version&quot; /&gt;
  97. &lt;!-- Facebook --&gt;
  98. &lt;provider
  99. android:name=&quot;com.facebook.FacebookContentProvider&quot;
  100. android:authorities=&quot;com.facebook.app.FacebookContentProvider1155209377959249&quot;
  101. android:exported=&quot;true&quot; /&gt;
  102. &lt;meta-data
  103. android:name=&quot;com.facebook.sdk.ApplicationId&quot;
  104. android:value=&quot;@string/facebook_app_id&quot; /&gt;
  105. &lt;activity
  106. android:name=&quot;com.facebook.FacebookActivity&quot;
  107. android:configChanges=&quot;keyboard|keyboardHidden|screenLayout|screenSize|orientation&quot;
  108. android:label=&quot;@string/app_name&quot;
  109. android:theme=&quot;@android:style/Theme.Translucent.NoTitleBar&quot; /&gt;
  110. &lt;!-- &lt;activity--&gt;
  111. &lt;!-- android:name=&quot;com.facebook.ads.InterstitialAdActivity&quot;--&gt;
  112. &lt;!-- android:configChanges=&quot;keyboardHidden|orientation|screenSize&quot;&gt;&lt;/activity&gt;--&gt;
  113. &lt;!-- &lt;activity android:name=&quot;com.facebook.ads.InterstitialAdActivity&quot; --&gt;
  114. &lt;!-- android:configChanges=&quot;keyboardHidden|orientation|screenSize&quot;/&gt; --&gt;
  115. &lt;!-- Facebook --&gt;
  116. &lt;!-- &lt;receiver android:name=&quot;com.google.android.gms.analytics.CampaignTrackingReceiver&quot; android:enabled=&quot;true&quot; android:exported=&quot;true&quot;&gt; --&gt;
  117. &lt;!-- &lt;intent-filter&gt;--&gt;
  118. &lt;!-- &lt;action android:name=&quot;com.android.vending.INSTALL_REFERRER&quot; /&gt;--&gt;
  119. &lt;!-- &lt;/intent-filter&gt;--&gt;
  120. &lt;!-- &lt;/receiver&gt;--&gt;
  121. &lt;!-- &lt;service android:name=&quot;com.google.android.gms.analytics.CampaignTrackingService&quot; android:enabled=&quot;true&quot; android:exported=&quot;false&quot; /&gt;--&gt;
  122. &lt;/application&gt;
  123. &lt;/manifest&gt;

答案1

得分: 1

我认为你上面的代码中有错误的闭合标签,尝试替换为:

  1. <activity
  2. android:name=".SecondActivity"
  3. android:screenOrientation="portrait"
  4. android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
  5. android:configChanges="orientation|keyboardHidden|screenSize" />
  6. <activity
  7. android:name=".SettingsActivity"
  8. android:screenOrientation="portrait" />
英文:

I think there are wrong closing tag from your above code,

try replace

  1. &lt;activity
  2. android:name=&quot;.SecondActivity&quot;
  3. android:screenOrientation=&quot;portrait&quot;
  4. android:theme=&quot;@android:style/Theme.Light.NoTitleBar.Fullscreen&quot; /&gt;
  5. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
  6. &lt;activity
  7. android:name=&quot;.SettingsActivity&quot;
  8. android:screenOrientation=&quot;portrait&quot; /&gt;

with this

  1. &lt;activity
  2. android:name=&quot;.SecondActivity&quot;
  3. android:screenOrientation=&quot;portrait&quot;
  4. android:theme=&quot;@android:style/Theme.Light.NoTitleBar.Fullscreen&quot;
  5. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;/&gt;
  6. &lt;activity
  7. android:name=&quot;.SettingsActivity&quot;
  8. android:screenOrientation=&quot;portrait&quot; /&gt;

答案2

得分: 0

我认为错误出现在这段代码中:

  1. android:configChanges="orientation|keyboardHidden|screenSize"

/> 移至较低位置。

英文:

I think the error is in this code:

  1. android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;

Move /&gt; on string lower.

huangapple
  • 本文由 发表于 2020年10月12日 19:22:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/64316902.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定