Skip to content

Commit

Permalink
chore: add error log for this.adb.setHiddenApiPolicy error
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Oct 14, 2023
1 parent f070232 commit 0a4f63e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,18 @@ class AndroidUiautomator2Driver
if (apiLevel >= 28) {
// Android P
this.log.info('Relaxing hidden api policy');
await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);
try {
await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);
} catch (err) {
this.log.errorAndThrow(
'Hidden API policy (https://developer.android.com/guide/app-compatibility/restrictions-non-sdk-interfaces) cannot be enabled. ' +
'This might be happening because the device under test is not configured properly. ' +
'Please check https://github.com/appium/appium/issues/13802 for more details. ' +
'You could also set the "appium:ignoreHiddenApiPolicyError" capability to true in order to ' +
'ignore this error, which might later lead to unexpected crashes or behavior of ' +
`the automation server. Original error: ${err.message}`
);
}
}

// check if we have to enable/disable gps before running the application
Expand Down

0 comments on commit 0a4f63e

Please sign in to comment.