Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After updating Gradle to 7.0.2, Element type “manifest” must be followed by either attribute specifications, “>” or “/>” error

So today I updated Android Studio to:

Android Studio Arctic Fox | 2020.3.1
Build #AI-203.7717.56.2031.7583922, built on July 26, 2021

An I got a 'Android Gradle Plugin can be upgraded' notification.

Until now, I was using:

Android Gradle Plugin: 4.2.2
Gradle: 6.9
Java: 8

However, after upgrading I got the error of the question.

My Manifest File looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hsd.contest.spain.clover.huawei">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true">
        <receiver
            android:name=".AlarmReceiver"
            android:enabled="true"
            android:exported="false" />

        <activity
            android:name=".ConsumeActivity"
            android:excludeFromRecents="true"
            android:launchMode="singleTask"
            android:taskAffinity="" />
        <activity android:name=".MapActivity" />
        <activity
            android:name=".SetTimeActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ActivityAddFreq"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait" />
        <activity
            android:name=".ConfigActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait" />
        <activity
            android:name=".SplashActivity"
            android:configChanges="orientation|keyboardHidden"
            android:launchMode="singleInstance"
            android:screenOrientation="portrait"
            android:theme="@style/SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait" />

        <meta-data
            android:name="preloaded_fonts"
            android:resource="@array/preloaded_fonts" />
    </application>
</manifest>

Do you have any ideas about why this is happening? Interesting fact: This error only happens in this project.

EDIT My Huawei APIs dependencies are the ones that follow: Module build.gradle

implementation 'com.huawei.agconnect:agconnect-core:1.5.0.300'
implementation 'com.huawei.hms:awareness:1.0.7.303'
implementation 'com.huawei.hms:ml-computer-vision-ocr:2.0.5.300'
implementation 'com.huawei.hms:ml-computer-vision-ocr-latin-model:2.0.5.300'
implementation 'com.huawei.hms:ml-computer-vision-ocr-cn-model:2.0.5.300'
implementation 'com.huawei.hms:location:5.0.4.300'
implementation 'com.huawei.hms:maps:4.0.0.301'
implementation 'com.huawei.hms:site:5.0.5.301'
implementation 'com.huawei.hms:hianalytics:5.0.3.300'
implementation 'com.huawei.hms:ads-lite:13.4.41.304'

Project build.gradle

classpath 'com.huawei.agconnect:agcp:1.4.2.300'
like image 643
xvlaze Avatar asked Jul 29 '21 12:07

xvlaze


People also ask

What is build gradle file in Android?

The top-level build.gradle file, located in the root project directory, defines dependencies that apply to all modules in your project. By default, the top-level build file uses the plugins block to define the Gradle dependencies that are common to all modules in the project.

What is app level build gradle file?

The Application level build. gradle file is located in each module of the android project. This file includes your package name as applicationID , version name(apk version), version code, minimum and target sdk for a specific application module.

What happened to Gradle configs?

These configurations are no longer used in modern Gradle builds that use variant aware dependency management and the new publishing plugins. While the configurations will stay in Gradle for backwards compatibility for now, using them to declare dependencies or to resolve dependencies is now deprecated.

Why is my Gradle plugin not working?

Update your plugins. Some plugins will break with this new version of Gradle, for example because they use internal APIs that have been removed or changed. The previous step will help you identify potential problems by issuing deprecation warnings when a plugin does try to use a deprecated part of the API.

What is the API configuration in Gradle 7?

The api configuration, available only if you apply the java-library plugin, should be used to declare dependencies which are part of the API of a library, that need to be exposed to consumers at compilation time. In Gradle 7, both the compile and runtime configurations are removed.

What happened to the Maven plugin in Gradle 7?

The maven plugin has been removed. You should use the maven-publish plugin instead. Please refer to the documentation of the Maven Publish plugin for more details. The uploadArchives task was used in combination with the legacy Ivy or Maven publishing mechanisms. It has been removed in Gradle 7.


3 Answers

The real solution I found by using trial and error version to use is

implementation 'com.huawei.agconnect:agcp:1.5.2.300'
like image 92
PedroAGSantos Avatar answered Oct 17 '22 01:10

PedroAGSantos


Encountered the same problem. Update Huawei services. Please take care. Remember to keep your dependencies on the most up-to-date version. This problem is happening on Merged-Manifest.

implementation 'com.huawei.agconnect:agconnect-core:1.4.0.300'

please use. -> 1.5.0.300

like image 4
snorlax Avatar answered Oct 17 '22 00:10

snorlax


same problem, updated to latest available version and it worked

classpath 'com.huawei.agconnect:agcp:1.6.0.300'
like image 1
Рафаэль солихов Avatar answered Oct 17 '22 00:10

Рафаэль солихов