Why is Android Studio 3.0.0 setting FLAG_TEST_ONLY on APKs?

后端 未结 1 974
天命终不由人
天命终不由人 2021-01-06 17:38

I have arrived at Android Studio 3.0.0 (from the stable channel) via 3.0.0-rcX (from the Canary channel).

When I start a brand new app and build it, the following co

1条回答
  •  抹茶落季
    2021-01-06 18:37

    I ran headlong into this the other day. Based on my testing, this flag is added only if you run the app from Android Studio. Unfortunately, the APK filename doesn't hint at the problem. And, despite the documentation, this APK is only usable from Android Studio — I specifically was trying to install it via adb, which is supposed to work, but doesn't.

    If you build the APK in other ways, the flag should not be added. Specifically, I used the assembleRelease Gradle task. I would expect the "Build APK(s)" menu option in Android Studio to work as well.

    Given Instant Run and other potential shenanigans that Android Studio might be doing for direct-run builds versus other ones, I am not surprised that they added this flag. Personally, I would love a clearer option to opt out of all such shenanigans (and perhaps this flag), as I'm one of those weirdos who wants the app that I run from the IDE to be the same app that my users run.

    FWIW, I have more background on this at this blog post.

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