Android Studio : install Release App by command li

2019-04-28 19:37发布

I want to export apk file "release apk" from command line when I run this command : gradlew installRelease

and I found this

Android Studio Task 'install Release' not found in root project ''. Some candidates are: 'uninstall Release'.

How can I solve it?

3条回答
仙女界的扛把子
2楼-- · 2019-04-28 20:05

My experience has been that the installRelease task does not become available until you define the signingConfigs in the buildTypes.release block of your build file, as shown in step 3 of Signing in Release Mode. Without signingConfigs, you will get other release tasks, such as assembleRelease, but not installRelease.

查看更多
三岁会撩人
3楼-- · 2019-04-28 20:06

So there is no such task. You can see all available tasks calling gradlew tasks. To assemble release version of apk call gradlew assembleRelease and then using adb install it.

查看更多
该账号已被封号
4楼-- · 2019-04-28 20:18

You may build with Android Studio Build/Generate Signed APK.... In this case you'll get .apk file in your repository. You then can use adb install .apk to install it. You'll have no changes in build.gradle file in this case.

Alternatively you may change build.gradle file as mentioned here. In this case you will have installRelease task. You may get these changes in build.gradle using Open Module Settings menu. See details in Gradle for Android and Java course from Udacity.

查看更多
登录 后发表回答