I am getting this error while I am building APK.
Cause 1: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while
I already had multidex enabled but the version was too old so upgraded and it fixed the issue:
// Old version
implementation 'com.android.support:multidex:1.0.3'
// New version
def multidex_version = "2.0.1"
implementation 'androidx.multidex:multidex:$multidex_version'
classpath 'com.android.tools.build:gradle:3.3.2' change class path and it will work
Try this, in Android Studio
File > Invalidate Caches/Restart...
found the solution.
add this code to your build.gradle,
dependencies {
def multidex_version = "2.0.1"
implementation 'androidx.multidex:multidex:$multidex_version'
}
then enable the multidex to true
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
Caused by 4: com.android.builder.internal.aapt.AaptException: Dependent features configured but no package ID was set.
All feature modules have to apply the library
plugin and NOT the application
plugin.
apply plugin: 'com.android.library'
It all depends on the stacktrace of each one. Cause 1 WorkExecutionException
may be the consequence of other causes. So I suggest reading the full stacktrace from the last cause printed towards the first cause. So if we solve the last cause, it is very likely that we will have fixed the chain of causes from the last to the first.
I attach an example of my stacktrace where the original or concrete problem was in the last cause:
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Caused by: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.2.0-alpha16-6840111-linux Daemon #0: Unexpected error during link, attempting to stop daemon.
Caused by: java.io.IOException: Unable to make AAPT link command.
Caused by 4: com.android.builder.internal.aapt.AaptException: Dependent features configured but no package ID was set.
GL
Feature Package ID was not set
I was also facing the same problem a few minutes before when I tried to run a flutter project in my C/(.something../.something../.something../.something....)
directory,
So I created a new folder in my E directory and started a new project there and when I run it ..... surprisingly it worked. I don't know why?
This was the message that I got after running in E: directory
Launching lib\main.dart on Lenovo K33a42 in debug mode...
Running Gradle task 'assembleDebug'...
Checking the license for package Android SDK Platform 28 in
C:\Users\Shankar\AppData\Local\Android\sdk\licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 6)".
"Install Android SDK Platform 28 (revision: 6)" ready.
Installing Android SDK Platform 28 in
C:\Users\Shankar\AppData\Local\Android\sdk\platforms\android-28
"Install Android SDK Platform 28 (revision: 6)" complete.
"Install Android SDK Platform 28 (revision: 6)" finished.
Parameter format not correct -
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
Debug service listening on ws://127.0.0.1:51105/5xCsT5vV62M=/ws
Syncing files to device Lenovo K33a42...