更新到 0.12 gradle 后插件脚本失败
After update to 0.12 gradle plugin script fails
我已将 gradle 插件更新为 0.12.+
。
但之后我收到错误消息
Error:A problem was found with the configuration of task ':processDebugResources'.
> File 'build\manifests\debug\debug\AndroidManifest.xml' specified for property 'manifestFile' does not exist.`
它非常适合 0.10.+
但是 android 工作室至少需要 12 个。
脚本的构建部分:
android.applicationVariants.all { variant ->
variant.processManifest.doLast {
copy {
//SET COPY PATHS
try {
from("${buildDir}/manifests") {
println "from: ${buildDir}/manifests"
include "${variant.dirName}/AndroidManifest.xml"
println "included: ${variant.dirName}/AndroidManifest.xml"
}
} catch (e) {
println "error: " + e
}
into("${buildDir}/manifests/${variant.name}")
println "into (neues Manifest): ${buildDir}/manifests/${variant.name}"
//DEFINE VARS
def brandVersion = variant.buildType.name
def brandVersionString = brandVersion.toString()
def gmaps_key = mapsapiprops['googleapiDebug']
if (brandVersionString.contains("release")) {
gmaps_key = mapsapiprops['googleapiRelease']
}
//REPLACE LINES IN MANIFEST
filter {
String line ->
line.replaceAll("<meta-data android:name=\"com.google.android.maps.v2.API_KEY\" android:value=\"\"/>",
"<meta-data android:name=\"com.google.android.maps.v2.API_KEY\" android:value=\"" + gmaps_key + "\"/>");
}
}
}
//SET PATH TO NEW MANIFEST
variant.processResources.manifestFile = file("${buildDir}/manifests/${variant.name}/${variant.name}/AndroidManifest.xml")
}
感谢您的帮助。
下载 0.5.7 Android Studio。工作了。
我已将 gradle 插件更新为 0.12.+
。
但之后我收到错误消息
Error:A problem was found with the configuration of task ':processDebugResources'.
> File 'build\manifests\debug\debug\AndroidManifest.xml' specified for property 'manifestFile' does not exist.`
它非常适合 0.10.+
但是 android 工作室至少需要 12 个。
脚本的构建部分:
android.applicationVariants.all { variant ->
variant.processManifest.doLast {
copy {
//SET COPY PATHS
try {
from("${buildDir}/manifests") {
println "from: ${buildDir}/manifests"
include "${variant.dirName}/AndroidManifest.xml"
println "included: ${variant.dirName}/AndroidManifest.xml"
}
} catch (e) {
println "error: " + e
}
into("${buildDir}/manifests/${variant.name}")
println "into (neues Manifest): ${buildDir}/manifests/${variant.name}"
//DEFINE VARS
def brandVersion = variant.buildType.name
def brandVersionString = brandVersion.toString()
def gmaps_key = mapsapiprops['googleapiDebug']
if (brandVersionString.contains("release")) {
gmaps_key = mapsapiprops['googleapiRelease']
}
//REPLACE LINES IN MANIFEST
filter {
String line ->
line.replaceAll("<meta-data android:name=\"com.google.android.maps.v2.API_KEY\" android:value=\"\"/>",
"<meta-data android:name=\"com.google.android.maps.v2.API_KEY\" android:value=\"" + gmaps_key + "\"/>");
}
}
}
//SET PATH TO NEW MANIFEST
variant.processResources.manifestFile = file("${buildDir}/manifests/${variant.name}/${variant.name}/AndroidManifest.xml")
}
感谢您的帮助。
下载 0.5.7 Android Studio。工作了。