Could not get unknown property 'assembleReleas

2020-06-07 06:45发布

After updating Android Studio to version 2.2 and the gradle plugin to 2.2.0, I get following error:

Error:(32, 1) A problem occurred evaluating project ':jobdispatcher'. Could not get unknown property 'assembleRelease' for project ':jobdispatcher' of type org.gradle.api.Project.

The problem is in the build.gradle file of an imported jobdispatcher module:

task aar(dependsOn: assembleRelease)

What changes can I make to fix this?

Note, this issue is very similar to, but still a bit different to, that reported here.

5条回答
乱世女痞
2楼-- · 2020-06-07 06:53

I had the same problem.

Disabling instant run under Android Studio/Preferences/Build, Execution, Deployment/Instant Run worked for me.

查看更多
我只想做你的唯一
3楼-- · 2020-06-07 06:54

Just add "" like this to fix your problem:

from:

task aar(dependsOn: assembleRelease)

to:

task aar(dependsOn: "assembleRelease")
查看更多
对你真心纯属浪费
4楼-- · 2020-06-07 07:04

Move your dependency dependsOn inside your gradle task like shown below:

task aar() << {
    dependsOn 'assembleRelease'
}
查看更多
疯言疯语
5楼-- · 2020-06-07 07:16
task aar {
    ....
}

aar.dependsOn('assembleRelease')

and task aar will run after task "assembleRelease" finished~

wish this will help you~ :-D

查看更多
啃猪蹄的小仙女
6楼-- · 2020-06-07 07:19

I tried all the previous answers, all are not working. Here is the one working after gradle 2.2. Starting from 2.2, those tasks also include "assembleDebug" and "assembleRelease". To access such tasks, the user will need to use an afterEvaluate closure:

afterEvaluate {
    task aar(dependsOn: assembleRelease) {
          //task
    }
}
查看更多
登录 后发表回答