Cannot create variant 'android-aidl' after dependency configuration 的解决办法
gradle编译的时候出现报错信息:
Cannot create variant 'android-aidl' after configuration ':puree:debugApiElements' has been resolved
意思是不能在debugApiElements
标签后面创建变体android-aidl
。
解决办法
先看来一段官方解释:
Update Gradle version from 4.1 to 4.4
In Gradle 4.4, it is a bug to resolve a configuration before the lint task is
created ([see [] Therefore, to upgrade
gradle version, we need to change the "generateJavadoc" task to remove using
files() call during initialization phase, but change move this to doFirst()
instead.
大概的意思是说,在4.4版本,这是一个bug。
还有网友也说:
It seems like it's an error coming from the version of Gradle you're using. You might be able to solve it by downgrading, as it's probably incompatible with a library you're using (which might be this one).
For reference, we're using Gradle version 2.3.3 in this project, so it might be worth giving that one a try.
这是一个bug,会出现在很早的版本里面。
查看网友的解决办法:
I fixed this issue by adding the classpath in the doFirst{ } block in build.gradle of our exoplayer module
alongwith applying the above mentioned fix.
大概是: 将classpath的初始化扔到doFirst里面,然后就能够顺利编译。
博主在项目中也使用这个办法,问题最后得到解决。
参考文章: https://github.com/watson-developer-cloud/android-sdk/issues/78
参考文章:https://blog.csdn.net/u013172664/article/details/88722971
参考文章:https://github.com/google/ExoPlayer/commit/13592dfb53ec99ce1fdb2744e34717dbdec9dea8
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。