🚀 DevOps Certified Professional
📅 Starting: 1st of Every Month 🤝 +91 8409492687 | 🤝 +1 (469) 756-6329 🔍 Contact@DevOpsSchool.com

How to solve “Failed to parse XML in AndroidManifest.xml

DevOps

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Error:

Caused by: com.android.builder.errors.EvalIssueException: Failed to parse XML in C:\Users\dharm\AndroidStudioProjects\mhn_app_doctor\android\app\src\main\AndroidManifest.xml The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.

AndroidManifest.xml

<!--android:hardwareAccelerated ="true"-->
<application
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:roundIcon="@drawable/icon_round"
android:supportsRtl="true"
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"
android:hardwareAccelerated="true">
<activity
android:name=".SelectColor"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".AddAimActivity"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".MainActivity"
android:screenOrientation="sensorPortrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PopActivity"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".AddActionAtivity"
android:theme="@style/AppTheme"
android:screenOrientation="sensorPortrait" />
<activity
android:name=".SelectIconActivity"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".EditActionActivity"
android:theme="@style/AppTheme"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".EditRoutineActivity"
android:theme="@style/AppTheme"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".EditAimActivity"
android:theme="@style/AppTheme"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".AddReminder"
android:screenOrientation="sensorPortrait"/>
<receiver
android:name=".AlarmReceiver"
android:screenOrientation="sensorPortrait"/>
<activity
android:name=".AddRoutine"
android:theme="@style/AppTheme"
android:screenOrientation="sensorPortrait"/>
<service android:name="net.eagledev.planner.BackgroundService" android:exported="false" />
<service android:name=".NotificationService"/>
</application>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
view raw gistfile1.txt hosted with ❤ by GitHub

App module

compileSdkVersion 28
defaultConfig {
applicationId "net.eagledev.planner"
minSdkVersion 23
targetSdkVersion 28
versionCode 5
versionName "0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}}
view raw gistfile1.txt hosted with ❤ by GitHub

Dependencies

implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
implementation 'com.android.support:design:28.0.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.github.clans:fab:1.6.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.support:recyclerview-v7:28'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-selection:28.0.0'
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation 'com.android.support:gridlayout-v7:28.0.0'
view raw gistfile1.txt hosted with ❤ by GitHub

Solution:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

Go to the project folder, in app ->> src ->> main and modify the AndroidManifest.xml with notepad.

You need to put the -uses permission- between

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.exemple">

Your manifest should be of this format:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test">

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>        
    <application 
        android:hardwareAccelerated="true">
        ...
    </application>

</manifest>
Subscribe
Notify of
guest


This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x