Google Play错误:无法上传仅限测试版APK [英] Google Play error: cannot upload a test-only APK
问题描述
当试图将第一个apk上传到最近在GooglePlay控制台中创建的项目时,我收到了这个错误:
您无法上传仅限测试版APK
搜索Google根据当前日期为该字符串提供0个结果。
我也为Play Console提交了一张票。如果有任何答案,将在这里更新。
更新2017年11月29日
由于保罗拉姆茨玛提出,解决方法。我们仍然会很高兴知道为什么我们需要采用gradle方式,而我们无法通过IDE来实现。
通过Android Studio 3.0和更高版本构建应用程序将添加 android:testOnly =true
添加到您的应用程序清单,将APK标记为 PackageManager> FLAG_TEST_ONLY
。 有关CommonsBlog的更多信息,请点击这里。
试图在Android Studio之外安装这样的APK将会失败:
无法安装app-debug.apk:失败[INSTALL_FAILED_TEST_ONLY:installPackageLI]
试图将其上传到Google Play也会失败:
您无法上传仅限测试版APK
有三种解决方案:
从Android Studio签名
只需选择从Android Studio的Build菜单中生成签名APK ...。
$ b
通过Gradle构建
你当然可以简单地从终端执行Gradle。此外,如果您的部署周期通过CI运行(它应该!),这真的是要走的路!
./ gradlew assembleRelease
(或者,您可能更愿意从Android Studio中的Gradle窗格运行此Gradle任务。 )
在Android Studio中禁用此功能
如果您不喜欢这种行为,您可以选择将此标志添加到 gradle.properties
中。请注意,测试标志是为了您自己的保护,所以您不会意外发布仅限测试版APK!
#Disble Android Studio的废话testOnly模式
android.injected.testOnly = false
When trying to upload the first apk to a recently created project in GooglePlay console, I receive this error:
You cannot upload a test-only APK
Searching Google gives me 0 results for that exact string as per today.
I also have submitted a ticket for Play Console. Will update here if have any answer.
UPDATE Nov 29th 2017
As @paul-lammertsma suggested, there's a workaround. Still would be good to know why we need to go gradle way and we cannot do it via IDE.
Building your app through Android Studio 3.0 and later will add android:testOnly="true"
to your application manifest, marking the APK as FLAG_TEST_ONLY
for the PackageManager. More information on CommonsBlog here.
Attempting to install such an APK outside of Android Studio will fail with:
Failed to install app-debug.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
Attempting to upload it to Google Play will also fail, with :
You cannot upload a test-only APK
There are three solutions to this:
Sign from Android Studio
Simply select "Generate Signed APK..." from the "Build" menu in Android Studio.
Build through Gradle
You can of course simply execute Gradle from the terminal. Besides, if your deployment cycle runs through CI (and it should!), this is really the way to go!
./gradlew assembleRelease
(Alternatively, you may prefer running this Gradle task from the Gradle pane from within Android Studio.)
Disable this feature in Android Studio
If you don't like this behavior, you may elect to add this flag to your gradle.properties
. Beware that the test flag is for your own protection, so you don't accidentally publish a test-only APK!
# Disble the bullshit testOnly mode for Android Studio
android.injected.testOnly=false
这篇关于Google Play错误:无法上传仅限测试版APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!