In Android Studio I have a sync error:
ERROR: Failed to parse XML in C:\...\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[70,1]
Message: expected start or end tag
Affected Modules: app
I added android:hardwareAccelerated ="true"
to AndroidManifest.xml
but this did not fix my problem. How should I resolve this?
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"/>
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'
}}
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'
<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">
and
<application>
</application>
Just go to 70th line of your Manifest and you will find any special character like - @, ,,#.. And in my case it was a dot(,). I just removed the dot and error vanished.
Reason because ParseError at [row,col]:[70,1]
given that error is in 70th row.
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>
https://developer.android.com/guide/topics/manifest/manifest-intro
Just had that exact error when working on an older project and updating it. I fixed it by opening the Manifest file in the text editor NotePadd++ and correcting issues with special characters.
In my manifest I had a special character just after my Internet Permission. It said LS. Not sure what it was, but I removed the character, saved the XML, then tried running Gradle Sync again and it solved the problem. Go to line 70 of your Manifest file from a Text Editor and remove the special character, and then try to see if gradle will work after.
I had similar problem after updating the gradle... in my manifest i had..
<activity android:name=".motoController">
android:screenOrientation="landscape"
</activity>
and just changed it to
<activity android:name=".motoController"
android:screenOrientation="landscape"/>
And the problem was gone...
I Have this problem....
Before
<application
android:name=".data.ThisApplication"
android:allowBackup="true"
android:label="@string/app_name" />
After
<application
android:name=".data.ThisApplication"
android:allowBackup="true"
android:label="@string/app_name"
I Just Remove "/>"
No Error After this
[row,col] Check exact row and column number in Manifest file and remove any unnecessary characters then your problem will resolve.
If error didn't solved then try clean,rebuild or build project. Sometimes restarting the android studio will solve the solution. Try Setting->Invalidate and Restart->Invalidate cache.
Any of the above solution will solve this error. If you have any other doubt ask it in comment box.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.