Fixed
Status Update
Comments
za...@gmail.com <za...@gmail.com> #2
./gradlew installDebug also fails with the same error.
ch...@gmail.com <ch...@gmail.com> #3
Furthermore, the -g option should not be added by default (with no way to disable) on all installs as it doesn't allow for easy testing of runtime permissions.
ga...@google.com <ga...@google.com> #4
Yuki, change ag/I3db0d26664d163f9164ee3f8c0f5c3916611445b seems to be the root cause.
4.1.0-beta02 is also impacted.
hu...@google.com <hu...@google.com>
ga...@google.com <ga...@google.com> #5
Runtime permissions were introduced in API 23, so this is most likely the root cause.
hu...@google.com <hu...@google.com> #6
I'll fix this issue by simply adding a API level check. "-g" option was added at the level 23.
We had a discussion in the team and decided to set "-g" by default. Here's reasons: 1) testing libraries (e.g. Espresso, orchestrator, etc) require it. 2) Starting in Android 10, a dialog is displayed asking for permission when you run a legacy apps (https://developer.android.com/about/versions/10/privacy/changes?hl=en#user-permission-legacy-apps ). This behavior change makes existing tests to be failed without "-g" option. 3) Dealing with the runtime permission check dialog in instrumentation tests is not easy and not reliable.
We had a discussion in the team and decided to set "-g" by default. Here's reasons: 1) testing libraries (e.g. Espresso, orchestrator, etc) require it. 2) Starting in Android 10, a dialog is displayed asking for permission when you run a legacy apps (
ch...@gmail.com <ch...@gmail.com> #7
Defaulting it to enabled with a wrapped api level check is fine but it should also be possible to disable it in the AGP dsl. it should be left up to the developer to decide when the permissions are granted and when they aren't. Especially given where it is implemented it applies to all installs done by Gradle, not just during instrumentation tests.
[Deleted User] <[Deleted User]> #9
I am experiencing the same issue. My instrumentation tests are installed with permissions granted. This causes our builds to fail, as we have espresso tests to verify the user paths when permissions are not granted.
What is the ETA for this DSL for disabling the automatic permission granting for instrumentation tests?
If have changed the behaviour completely with the release 4.1.0 you should at least provide at the same time the DSL which disables new behaviour.
At the moment this issue blocks further updates of AGP and in the end is a blocker to migrate to Jetpack Compose for many developers.
What is the ETA for this DSL for disabling the automatic permission granting for instrumentation tests?
If have changed the behaviour completely with the release 4.1.0 you should at least provide at the same time the DSL which disables new behaviour.
At the moment this issue blocks further updates of AGP and in the end is a blocker to migrate to Jetpack Compose for many developers.
Description
Emulator version: 30.0.16-6549980
SDK tools: 30.0.0
AGP version: 4.2.0-alpha01
Gradle version: 6.5
Host CPU: 2.3 GHz 8-Core Intel Core i9
Steps to reproduce:
1. Setup an app with the above versions of tooling.
2. Start an emulator for Android 5.0.
3. Run ./gradlew connectedCheck from the command line.
Error:
com.android.build.gradle.internal.testing.ConnectedDevice > runTests[Pixel_API_21(AVD) - 5.0.2] FAILED
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unknown failure: Error: Unknown option: -g
at com.android.build.gradle.internal.testing.ConnectedDevice.installPackage(ConnectedDevice.java:133)
(full stacktrace attached)