cd <path-to-platform-tools> # <path-to-platform-tools> 是上一步下载的 Platform Tools 的目录
.\adb.exe shell settings put global http_proxy 127.0.0.1:7890 # 这里 7890 可以根据需要修改
#.\adb.exe shell settings put global http_proxy :0 # 用于关闭系统代理
.\adb.exe shell settings put global global_http_proxy_exclusion_list localhost,*.ts.net # 这里是排除列表
adb settings put global http_proxy 127.0.0.1:7890
adb.exe: unknown command settings
查了一下应该是adb shell
adb shell settings put global http_proxy 127.0.0.1:7890
Exception occurred while executing 'put':
java.lang.SecurityException: Permission denial, must have one of: [android.permission.WRITE_SECURE_SETTINGS]
at com.android.providers.settings.SettingsProvider.enforceHasAtLeastOnePermission(SettingsProvider.java:2645)
at com.android.providers.settings.SettingsProvider.mutateGlobalSetting(SettingsProvider.java:1608)
at com.android.providers.settings.SettingsProvider.insertGlobalSetting(SettingsProvider.java:1562)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:522)
at android.content.ContentProvider.call(ContentProvider.java:2716)
at android.content.ContentProvider$Transport.call(ContentProvider.java:641)
at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:385)
at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:281)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:53)
at android.os.Binder.shellCommand(Binder.java:1092)
at android.os.Binder.onTransact(Binder.java:912)
at android.os.Binder.execTransactInternal(Binder.java:1392)
at android.os.Binder.execTransact(Binder.java:1299)