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'
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.
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.
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.
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.
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.
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.
The real solution I found by using trial and error version to use is
implementation 'com.huawei.agconnect:agcp:1.5.2.300'
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
same problem, updated to latest available version and it worked
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With