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'
That error is due to Huawei outdate libraries. I followed instructions here to update to latest version: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-apm-android-releasenotes-0000001052887266
It is important to follow the notice:
NOTICE Since version 1.5.2.302, the APMS plugin capabilities have been integrated into the AppGallery Connect plugin. To update the SDK version to 1.5.2.302 or later, you need to complete certain configurations to ensure compatibility with the original plugin functions. For details, please refer to the version change history of version 1.5.2.302.
I also have to change
implementation 'com.huawei.agconnect:agconnect-core:1.5.2.307'
to
implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300'
For some reason (unknown to me) version 1.5.2.307 couldn't be found.