Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Dependent features configured but no package ID was set." When creating a new module Android

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.
like image 855
Nurseyit Tursunkulov Avatar asked Feb 29 '20 04:02

Nurseyit Tursunkulov


People also ask

What happens when I add a new module to my Android project?

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.

What is an app module in Android Studio?

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.

What is a package attribute in Android?

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.

Do I need to support Android app bundles?

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 .


Video Answer


4 Answers

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.

like image 81
Reedy Avatar answered Oct 17 '22 16:10

Reedy


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)
     .........
}
like image 6
albaspazio Avatar answered Oct 17 '22 17:10

albaspazio


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

like image 6
dengST30 Avatar answered Oct 17 '22 18:10

dengST30


Check if your module is : library and not app

in build.gradle check if : 'com. android. library'

like image 3
Mohammed Kadi Avatar answered Oct 17 '22 17:10

Mohammed Kadi