I am currently trying to update Android Studio to 1.0.0-RC. This seems to require gradle Android plugin 1.0.0-rc1. After the update, I started having the following error:
`Could not find property 'processManifest' on com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@b9da89c.`
With some digging, it seems that processManifest
is one of the deprecated properties that were removed in 0.14.3 version . Any idea what the new property name is? The same user guide has not been updated for the new version, so I can't find any documentation for it.
EDIT: Here is the code that needs the property. I use it to inject some build-time values into the manifest:
applicationVariants.all { variant ->
variant.processManifest << {
def manifestOutFile = variant.processManifest.manifestOutputFile
def newFileContents = manifestOutFile.getText('UTF-8')
.replace("{GOOGLE_MAPS_KEY}", variant.buildType.ext.google_maps_key)
manifestOutFile.write(newFileContents, 'UTF-8')
}
}
I got this error as well after updating to Android Studio 1.0.0 on the Beta Channel. However, I could not find any reference in my own gradle files to processManifest
. After some searching, I realized that I needed a new Robolectric gradle plugin:
https://github.com/robolectric/robolectric-gradle-plugin/releases
Using version 0.14.0 of the Robolectric Gradle Plugin (and version 2.4 of Robolectric) has resolved the error for me.
I have not been able to find a solution to the problem, but simply a workaround. Android Gradle plugin Version 0.11 introduces a new API called Manifest merger . It allows to achieve the same thing that my hack allowed me to do.
Here are the changes needed:
"${GOOGLE_MAPS_KEY}"
Define a manifestPlaceholders
map in each BuildType. That is:
buildTypes { debug { manifestPlaceholders = [GOOGLE_MAPS_KEY: "xxxxxxxxxxxxxxxxxxxx"] } release { manifestPlaceholders = [GOOGLE_MAPS_KEY: "xxxxxxxxxxxxxxxxxxxx"] } }
That's it! The plugin will automatically replace those variables in your Manifest. Pretty neat!
According to the documentation for APK splits ( http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits ) this method has moved into VariantOutput
(available via variant.outputs
):
Deprecation Warning : the current variant API contains some methods that have moved under its outputs. The method are still there, but will fail if there are 2+ outputs. They will be completely removed in 1.0 These are:
Additional methods on VariantOutput
android.applicationVariants.all{ variant ->
variant.outputs.each { output ->
output.processManifest.doLast{
def manifestFile = output.processManifest.manifestOutputFile
def updatedContent =manifestFile.getText('UTF-8').replaceAll("UMENG_CHANNEL_VALUE", "${variant.productFlavors[0].name}")
manifestFile.write(updatedContent, 'UTF-8')
}
}
}
I changed it in this way, which just add a new layer outside the older one. This works because processManifest
is now in the outputs
field. Think this could be helpful.
In my case I was getting this error because there was a dependency on a library folder specified in my settings.gradle . That folder had a lot of faulty configurations apparently. So as soon as I removed it from settings.gradle, the project compiled just fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.