I am trying to create a new module. Elements of this module should be visible to the first module.That is why I add implementation project(":messanger")
to Build.gradle(:app)
but it gives the following error:
Dependent features configured but no package ID was set.
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing
com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-4.0.0-beta01-6051327-linux Daemon #0: Unexpected error during link, attempting
to
stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
Android Studio creates all the necessary files for the new module and syncs the project with the new module gradle files. Adding a module for a new device also adds any required dependencies for the target device to the module's build file.
That’s because the module that includes code and resources for your app’s base APK is the standard app module, which you get by default when you create a new app project in Android Studio . That is, the module that applies the application plugin below to its build.gradle file provides the code and resources for the base functionality of your app.
The package attribute is where Google Play Store and the Android platform actually look to identify your app; so once the build has made use of the original value (to namespace the R class and resolve manifest class names), it discards that value and replaces it with the application ID.
Most app projects won’t require much effort to support Android App Bundles. That’s because the module that includes code and resources for your app’s base APK is the standard app module, which you get by default when you create a new app project in Android Studio .
The module you have created is using the plugin 'com.android.application' and it should be using the 'com.android.library' plugin. You can find this in the build.gradle file in your module, change this to use the library plugin and it should compile.
I integrate the present Reedy answer, stressing that two different plugins must be used for app and modules.
if you move to a buildSrc approach (highly suggested) you should declare two different variables in: buildSrc/src/main/java/dependencies.kt
object Plugins {
const val androidApplication = "com.android.application"
const val androidLibrary = "com.android.library"
}
and use them properly in app and mymodule build.gradle
:app
plugins {
id(Plugins.androidApplication)
.......
}
and
:mymodule
plugins {
id(Plugins.androidLibrary)
.........
}
If the module is an library , not an application
use the following configuration in build.gradle ( for the module )
plugins {
// id 'com.android.application'
id "com.android.library"
}
android {
defaultConfig {
// applicationId "com.xxx.xx.x"
}
}
It seems like that , the library did not need an applicationId
Check if your module is : library and not app
in build.gradle check if : 'com. android. library'
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