Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Android project should be updated from AGP 7.4.2 #1883

Open
hanis0 opened this issue Jan 29, 2024 · 1 comment
Open

The Android project should be updated from AGP 7.4.2 #1883

hanis0 opened this issue Jan 29, 2024 · 1 comment
Labels
best practice Not a defect but something that should be improved anyway

Comments

@hanis0
Copy link

hanis0 commented Jan 29, 2024

Description

Warnings

AGP update recommended

There is this new Android Gradle Plugin (AGP) warning present since the recent upgrade to support Android SDK 34 (#1856, #1880).

We recommend using a newer Android Gradle plugin to use compileSdk = 34

This Android Gradle plugin (7.4.2) was tested up to compileSdk = 33

This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=34
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to use a newer Android Gradle Plugin that has been tested with compileSdk = 34

Screenshot 2024-01-27 at 7 02 12

Deprecated attribute in AndroidManifest.xml

And there's also one older yet related warning thrown by the manifest processing task.

package="com.smartdevicelink" found in source AndroidManifest.xml:…/sdl_java_suite/android/sdl_android/src/main/AndroidManifest.xml.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

Screenshot 2024-01-27 at 7 28 23

Impact

Users of the sdl_android module who link the module source code are affected by the deprecated attribute in AndroidManifest.xml warning and because of that they cannot upgrade their project's AGP to 8+ versions without any custom modifications to the sdl_android module's source code.

@hanis0 hanis0 added the best practice Not a defect but something that should be improved anyway label Jan 29, 2024
@hanis0
Copy link
Author

hanis0 commented Jan 29, 2024

Attaching SDL_Issue_1883.patch GIT Patch that I believe to resolve the AGP update recommended issue which also includes a resolution of the Deprecated attribute in AndroidManifest.xml issue.

Most of the changes were do by the AGP Upgrade Assistant tool. However it would fail to load the project after the upgrade with this exception:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':sdl_android'.
	at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:84)
…
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: org.gradle.api.UnknownDomainObjectException: SoftwareComponent with name 'release' not found.
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.createNotFoundException(DefaultNamedDomainObjectCollection.java:504)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:333)
	at com.vanniktech.maven.publish.MavenPublishConfigurer.configureAndroidArtifacts(MavenPublishConfigurer.kt:152)
	at com.vanniktech.maven.publish.MavenPublishPlugin.configurePublishing(MavenPublishPlugin.kt:87)
	at com.vanniktech.maven.publish.MavenPublishPlugin.access$configurePublishing(MavenPublishPlugin.kt:13)
	at com.vanniktech.maven.publish.MavenPublishPlugin$apply$1.execute(MavenPublishPlugin.kt:43)
	at com.vanniktech.maven.publish.MavenPublishPlugin$apply$1.execute(MavenPublishPlugin.kt:13)
…

Update of the com.vanniktech:gradle-maven-publish-plugin:0.13.0 dependency to the most recent com.vanniktech:gradle-maven-publish-plugin:0.27.0 seems to fix the exception and the Android project loads fine.

There are some failing tests but all of those had been failing for me also before the AGP update.
Screenshot 2024-01-29 at 11 03 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
best practice Not a defect but something that should be improved anyway
Projects
None yet
Development

No branches or pull requests

1 participant