How to create a release signed apk file using Gradle?

前端 未结 30 1852
既然无缘
既然无缘 2020-11-22 13:48

I would like to have my Gradle build to create a release signed apk file using Gradle.

I\'m not sure if the code is correct or if I\'m missing a parameter when doing

30条回答
  •  生来不讨喜
    2020-11-22 14:18

    I had several issues that I put the following line in a wrong place:

    signingConfigs {
        release {
            // We can leave these in environment variables
            storeFile file("d:\\Fejlesztés\\******.keystore")
            keyAlias "mykey"
    
            // These two lines make gradle believe that the signingConfigs
            // section is complete. Without them, tasks like installRelease
            // will not be available!
            storePassword "*****"
            keyPassword "******"
        }
    }
    

    Make sure that you put the signingConfigs parts inside the android section:

    android
    {
        ....
        signingConfigs {
            release {
              ...
            }
        }
    }
    

    instead of

    android
    {
        ....
    }
    
    signingConfigs {
       release {
            ...
       }
    }
    

    It is easy to make this mistake.

提交回复
热议问题