adb shell input text 完美支持中文输入

ADBKeyBoard.apk 完美解决中文输出 注意,路径是区分大小写的,因此需要确保路径的准确无误。请用你的ADBKeyboard.apk的实际路径替换。是你的ADBKeyboard.apk的实际路径。查看输入法列表:adb命令。从发布页面下载APK。 阅读详情
AI摘要

本文介绍了一种使用ADBKeyBoard输入法实现通过ADB命令在手机或模拟器上输入中文的方法。首先需要安装ADBKeyBoard输入法并将其设为默认输入法,然后通过特定ADB命令即可实现中文输入。

adb 默认是不支持Unicode编码的,无法通过adb shell input text 命令输入中文到手机或模拟器


解决中文输入 还得感谢老外写了一个输入法,源码地址:https://github.com/senzhk/ADBKeyBoard


第一步:安装ADBKeyBoard.apk文件

打开手机或模拟器,adb install ADBKeyBoard.apk安装该输入法

或者直接安装即可


第二步:设置默认输入法



默认输入法也选择ADB keyboard,如果是模拟器还有一个也要设置,很奇怪,不设置该项就无法成功输入中文,我也是无意中发现的,那就是选择默认输入法的时候,hardware physical keyboard得off,默认是on


第三步:用adb命令输入中文测试OK

adb shell am broadcast -a ADB_INPUT_TEXT --es msg '不错,可以学着品红酒的好工具'



大功告成,中文字符成功输入!


附录:

ADBKeyBoard.apk  下载:http://download.csdn.net/detail/slimboy123/9730839

adb.exe下载:http://download.csdn.net/detail/slimboy123/9730833

adb shell input 分析(1) adb shell input的功能 adb shell input可以通过adb命令行发送input事件。包含keyevent和text两种。 keyevent 对于安卓API KeyEvent定义的健值均可支持 https://developer.android.com/reference/android/view/KeyEvent 健值举例: KEYCODE_0 Added i... 阅读详情

相关推荐

adb shell input text中文输入失败排查与五种方案

在Android自动化测试中,ADB文本输入常被用于登录、搜索和表单填写,但adb shell input text对字符集存在边界:它依赖KeyCharacterMap虚拟键盘映射,将字符转换为按键事件,非ASCII中文缺少对应映射时便静默失败。理解字符编码、按键事件模型与输入法/无障碍通道的差异,是提升移动端自动化稳定性的基础。实际场景中,Appium、UiAutomator2等框架可通过setText绕开按键注入,调试输入法广播则适合纯ADB脚本。围绕adb shell input text中文输入失

weixin_29192365的博客 178

adb shell input text 输入中文

由于adb 不支持中文输入(不支持 Unicode),需要使用虚拟键盘绕一圈。

lsq126yx的博客 5075

ADB命令深度解析:Android输入法程序化控制与自动化实战

在Android开发与自动化测试领域,程序化控制设备是提升效率的关键。Android Debug Bridge(ADB)作为官方命令行工具,提供了与设备深度交互的能力,其核心原理在于通过客户端-服务器架构,在设备Shell中执行命令并与系统服务通信。其中,对输入法框架(Input Method Framework)的控制具有重要技术价值,它能实现输入法的查询、切换、启用/禁用以及文本注入,从而确保测试环境的纯净与自动化流程的稳定。这一能力在UI自动化测试、批量数据填充、设备故障应急处理等场景中尤为实用。例如

weixin_33881140的博客 630

模拟键盘输入adb shell input

>adb shell input Usage: input [<source>] <command> [<arg>...] The sources are: dpad keyboard mouse touchpad gamepad touchnavigation joystick touchscreen stylus trackball The...

格物致知的专栏 [音视频编解码 网络协议 计算机视觉 计算机图形学 图像理解 语音识别 机器学习 模拟电路 传感器] 4232

ADB 输入中文失败原因与自动化输入方案

在 Android 自动化测试与设备批量操作中,文本输入常被简化为“向输入框发送字符串”,但底层输入事件通道、字符映射与输入连接机制决定了并非所有字符都能被直接注入。ADB 的 input text 本质是模拟按键,遇到中文等非键盘映射字符会静默失败;理解输入法提交、Base64 编码传输和无障碍节点赋值等通道,能提升脚本跨设备稳定性与可维护性。该能力广泛用于 App UI 自动化、表单批量填写、回归测试与多设备群控等场景。围绕 adb shell input text 输入中文、Base64 广播输入和输

weixin_42639246的博客 255

如何实现对Android设备进行文本的模拟输入

如何实现对Android设备进行文本的模拟输入adb shell input textADBKeyBoardInputManager.injectInputEvent总结 基于android的自动化测试,或者对android进行控制,ADB是不二之选,这也是官方开发成熟的工具,今天讨论的话题是“如何实现对Android设备进行文本的模拟输入”。 adb shell input text adb提供...

m0_38143970的博客 3233

adb shell input text 中文输入方法

adb输入中文问题:adb不支持unicode字符,只支持ASICC字符。所以直接输入汉字会报错 那么可以用ADBKeyBoard.apk 下载地址https://pan.baidu.com/s/1zTH4V2iwF9PZKtEu_ICz6w提取码tnw7 百度网盘 请输入提取码提取码edcv 下载后解压安装apk 安装后,设置手机输入法默认输入法,如图 adb输入:adb shell am broadcast -a ADB_INPUT_TEXT --es msg 汉字可以啦 发现可以了...

qq_41554671的博客 3588

Android13 adb input 调试命令使用和源码解析

本章重点Android13 adb input 调试命令的使用和源码分析 通过命令来模拟用户在设备上的各种操作,从而进行测试、调试或其他目的。通过阅读源码来深入了解Android 13系统的输入事件管理机制。

我其实什么都不会 6819

adb shell输入中文(ADBKeyBoard)

前言 “adb shell input text yoyo“ 可以通过adb 输入英文的文本,由于不支持unicode编码,所以无法输入中文,github上有个国外的大神写了个ADBKeyBoard输入法的apk,完美支持unicode编码,也能输入中文和其它字符了 ADBKeyBoard 1.ADBKeyBoard在github的源码地址ADBKeyBoard github 地址,有兴趣的...

angel725的专栏 7703

Nvidia Isaac Sim图形界面 入门教程 2024(3)

在使用Isaac Sim时,最先接触到的应该是它的图形界面,此处将简单介绍图形界面中常用的一些组件:Isaac Sim的界面的常用内容可以分为几个板块。

m0_56661101的博客 4549

手把手教你用运放和基准源,把±10V信号变成ADC能吃的0-4V(附完整计算过程)

本文详细介绍了如何利用OP07运放和REF5040基准源设计工业级信号调理电路,将±10V传感器信号转换为0-4V ADC可接受范围。通过七步流程,包括需求分析、元器件选型、电路设计、理论计算、PCB布局、实测验证与性能优化,帮助工程师解决信号不匹配问题,提升系统精度与稳定性。

weixin_28731223的博客 477

解决 adb shell input text 无法中文的问题

背景 使用 adb 在手机上进行模拟发布评论的操作时,需要在文本框中文,但是 adb shell input 中文文本 无法正常工作。 解决办法 前往 https://github.com/senzhk/ADBKeyBoard ,页面最下方有个可以下载 apk 的地址 下载好后,执行 adb install {apk的所在路径} 安装 apk 输入法管理里面勾上 ADB keyboard 设置当前输入法为选择 ADB keyboard 测试 使用命令 adb shell am broadcast -a

狗斯特里的博客 4305

【01、Go与VSCode的安装】

小白学Go语言

wangruil的博客 1542

python中利用adb shell 控制手机,完美解决中文输入问题

1.连接手机, 打开开发者选项, 连接USB, (如果需要记录手机浏览的数据,下载安装,配置fiddler, 配置代理 参照我以前写的这个文章就行http://st4024589553.iteye.com/blog/2363667) (当然你也可以安装一个模拟器来玩玩,一样的,可以操控多个模拟器) 2.要解决直接在APP输入中文,而不是打拼音,选汉字,这里需要为手机或者模拟器安装一个a...

pergoods的博客 1348

【硬件开源实战】STM32G070RBT6开发板从设计到避坑全解析

本文全面解析了STM32G070RBT6开发板从硬件设计到避坑的实战经验。详细介绍了电源设计、时钟电路、PCB布局等关键环节,分享了成本控制、焊接测试、软件开发和外设驱动的实用技巧,帮助开发者高效完成项目开发。

weixin_26897585的博客 251

导航系统 | 全球四大卫星导航系统(2025)核心能力对比分析

北斗系统通过GEO卫星(80°E、110.5°E、140°E)实现区域增强,其IGSO卫星在亚太地区形成"8"字形轨迹,使该区域可见卫星数量比GPS多4-6颗,显著提升复杂环境下的定位可用性[13]。北斗短报文功能在2025年云南地震救援中发挥关键作用,被困人员通过北斗终端发送120字求救信息,实现"位置+状态"一体化上报,救援响应时间缩短40%[15]。北斗通过三频信号(B1C/B2a/B3)消除电离层延迟误差,在城市峡谷环境下定位连续性达99.98%,优于GPS的99.95%[5]。

尘世冰封的专栏 2632

ADB版本过低导致ADBKeyboard中文输入乱码

今天,要调试adb shell input text ‘[input_text]’。输入中文时,进程Killed了。原来adb input不支持中文。因为ascii里没有中文,当然除了中文其它非ACSII的编码均会导致killed。 辗转到网上搜了下,有个https://github.com/senzhk/ADBKeyBoard 写的apk可通过监听广播将中文传入。其实,就是通过unicode转码...

weixin_33872660的博客 1376

立体仓库WCS控制系统-AGV通信代码

string str = "任务下发,WCS->NT8000(q-Message),ikey:" + p.ikey.ToString() + "fromStation:" + p.fromStation.ToString() + "toStation:" + p.toStation.ToString();if (nt8000.Connect(_ServerAddr, _ServerPort)) QueueSpeech.AddQueue(string.Format("与NT8000重连成功"));

xdpcxq的专栏 2210

appium 解决adb 中文输入问题

在移动测试时经常要控制文字输入,如用appium的元素send_keys()可解决输入中文的问题,但输入速度很慢。如直接调用adb shell 的“adb shell input text”可以通过adb 输入英文的文本,但由于不支持unicode编码,所以无法输入中文。 可以通过手机安装ADBKeyBoard输入法的apk,实现完美支持unicode编码,也能输入中文和其它字符。 步骤: ...

wenzhp1975的博客 1892

VxWorks系列 快速导航

Vxworks系列快速阅览导航

Mr.Sugarcane 1325

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

解决adb shell input text 中文输入,unicode转utf-8

https://github.com/senzhk/ADBKeyBoard 上面这个是外国人写的一个输入法,我们把它安装再设置下就ok了 直接下载bin下的ADBKeyBoard.apk文件,或者上面那个网址最下端也有一个apk文件链接 第一个 1.安装 打开模拟器,adb install ADBKeyBoard.apk安装该输入法 2.设置 模拟器的settings-----l

u011068616的专栏 3万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

解决adb输入中文以及乱码的问题

首先是第一个问题:如何解决用adb向安卓模拟器输入中文,这个百度教程会有一大堆,几乎都是用ADBKeyBoard来解决的,而且几乎都是复制的博客。本文也是用该方法进行解决的,可以直接到git上下载。 git链接:https://github.com/senzhk/ADBKeyBoard 安装后可以手动将ADB输入法设置为默认,或者通过如下吗命令进行设置 adb shell settings put secure default_input_method ime set com.android.ad

任萌新的小生活 7701

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

安卓4电视没有输入法?从框架原理到adb绕行调试完整指南

输入法(IME)在安卓系统中并非普通应用,而是依赖InputMethodService的系统服务,需要被系统注册并设置为默认才能弹出键盘。老电视与盒子常因ROM精简、APK版本过旧或CPU架构不匹配,导致安装失败或无法启用,现象即“没有可用输入法”。理解其运行机理后,可通过adb命令检查输入法服务列表、直接安装或设置默认输入法,甚至绕过输入法框架,用input text、剪贴板广播或USB键盘完成文字输入。这套排查思路适用于安卓4.x智能电视、机顶盒的调试场景,也能帮助开发者在TV应用交互设计中规避键盘弹不

weixin_34411563的博客 346
上一篇: ADB命令启动指定应用市场打开指定应用详情页
下一篇: SQL Server日志文件过大 大日志文件清理方法 不分离数据库
slimboy123
博客等级 码龄20年 106粉丝 39原创
评论 21
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值