In my Dart project pubspect.yaml uses on_audio_query: 2.9.0 , which depends on on_audio_query_android.
I have recently upgraded to Java 21.0.4 and Gradle 8.1
The upgrade was motivated by switching to a newer Android device: version 14.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':on_audio_query_android'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
> Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
How can one specify the namespace for an included module?
With older java and Dart things run fine on android.
The plugin you are using hasn't been updated in almost two years, so I don't think you can rely on getting an update for it anytime soon.
If you look inside the on_audio_query_android repository, you will see that it is using Gradle version 4.1.3 and therefore does not have the namespace attribute required by the Gradle version you are using.
The only way I can see that you can get around this, is to alter the plugin itself locally (the build.gradle file) and adding the appropriate namespace attribute.
The below code snippet has been taken from the plugin's repository:
android {
namespace 'com.lucasjosino.on_audio_query'. /// <----
compileSdkVersion 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 16
}
}
There could also be other underlying issues.