Could not find property 'processManifest' on com.android.build.gradle.internal.api.ApplicationVariantImpl

后端 未结 5 2062
遇见更好的自我
遇见更好的自我 2020-12-15 19:37

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:

相关标签:
5条回答
  • 2020-12-15 20:16

    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:

    • Surround any variable that you inject in your manifest with "${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!

    0 讨论(0)
  • 2020-12-15 20:17
    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.

    0 讨论(0)
  • 2020-12-15 20:20

    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:

    • get/setOutputFile
    • getProcessResources
    • getProcessManifest
    • getPackageApplication/Library
    • getZipAlign

    Additional methods on VariantOutput

    • String getAbiFilter()
    • String getDensityFilter()
    • Task getAssemble()
    • String getName()
    • String getBaseName()
    • String getDirName
    • set/getVersionOverride // optional versionCode override
    • int getVersionCode() // returns either the versionCode override from the output or the versionCode from the variant itself
    0 讨论(0)
  • 2020-12-15 20:36

    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.

    0 讨论(0)
  • 2020-12-15 20:37

    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.

    0 讨论(0)
提交回复
热议问题