[英]Android Studio Gradle Cannot resolve symbol 'applicationVariants'
I'm trying to get around an annoying issue with Gradle that does not allow libraries to have different min/target sdk's. 我试图解决Gradle的一个烦人的问题,它不允许库有不同的最小/目标sdk。 The solution was to add the following to build.gradle. 解决方案是将以下内容添加到build.gradle中。
android.applicationVariants.all{ variant ->
// This is an annoying hack to get around the fact that the Gradle plugin does not support
// having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread)
// but Android Maps Utils supports 8 (Froyo) still
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/exploded-bundles/ComGoogleMapsAndroidAndroidMapsUtils03.aar/AndroidManifest.xml")
if (manifestFile.exists()) {
println("Replacing minSdkVersion in Android Maps Utils")
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="8"/, 'minSdkVersion=\"9\"')
manifestFile.write(content, 'UTF-8')
println(content)
}
}
}
However when i do that, I get an error that applicationVariants cannot be resolved. 但是当我这样做时,我收到一个错误,即applicationVariants无法解析。 How do I fix this? 我该如何解决?
Aparrently, this is an Android Studio bug and is telling me there are errors where there's none. 很明显,这是一个Android Studio错误,并告诉我有没有错误。 Building and ignoring works fine. 建立和忽略工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.