A failure occurred while executing com.android.build.gradle.internal.tasks

后端 未结 19 4253
臣服心动
臣服心动 2020-12-04 23:27

I am getting this error while I am building APK.

Cause 1: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while          


        
相关标签:
19条回答
  • 2020-12-05 00:08

    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'
    
    0 讨论(0)
  • 2020-12-05 00:08

    classpath 'com.android.tools.build:gradle:3.3.2' change class path and it will work

    0 讨论(0)
  • 2020-12-05 00:09

    Try this, in Android Studio

    File > Invalidate Caches/Restart... 
    
    0 讨论(0)
  • 2020-12-05 00:09

    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
        }
    
    
    
    0 讨论(0)
  • 2020-12-05 00:10

    Solution for:

    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.

    build.gradle (:androidApp:feature_A)

    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

    0 讨论(0)
  • 2020-12-05 00:12

    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...
    
    0 讨论(0)
提交回复
热议问题