如何在传统的Android设备上测试EMDK功能?

huangapple go评论81阅读模式
英文:

How to Test EMDK functionality on traditional android Device?

问题

以下是您要翻译的内容:

所以我已经被困住了一段时间,一直在纠结,我不知道如何在模拟器或者我的测试安卓设备上测试我的应用,当我尝试运行应用程序时,它会出现安装错误

09/02 14:17:01: 在 Pixel API 24 上启动'app'。
安装未成功。
无法安装应用程序:INSTALL_FAILED_MISSING_SHARED_LIBRARY

APK 列表:[0]
'/home/username/AndroidStudioProjects/projectName/app/build/outputs/apk/debug/app-debug.apk'
安装失败原因:'null' 重试

尝试的解决方案

可能解决方案的Stackoverflow链接

英文:

So I've been stuck for a while, scratching my head around, I don't know how to test my application on Emulator or on my testing android device, when I try to run the application it gives an error on installation

> 09/02 14:17:01: Launching 'app' on Pixel API 24.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_MISSING_SHARED_LIBRARY
>
> List of apks: [0]
> '/home/username/AndroidStudioProjects/projectName/app/build/outputs/apk/debug/app-debug.apk'
> Installation failed due to: 'null' Retry

Solutions Tried

Stackoverflow Link to the possible solution

答案1

得分: 0

经过一番密集搜索和多次失败后,我找到了一个解决方案,这不是最终解决方案,而是在开发阶段测试 EMDK 应用程序的一种变通方法。对于新手来说很难,但如果你具有使用 JUNIT 进行仪器化测试的先前知识,它将会变得有意义。

仪器化测试

// 模拟扫描条形码
mockedInterface.AddScanData("123456789");
ScanDataCollection scanDataCollection = mockedInterface.ReportScan(success);

传递测试数据

// 触发数据监听器
activity.onData(scanDataCollection);

检查数据的可靠性

// 测试是否正确扫描了数据
onView(withId(R.id.textViewData)).check(matches(withText("0123456789\n")));

示例项目的 GitHub 链接:
Github

原始来源链接:
原始来源

英文:

After an Intensive search and many failures, I came across a solution which is not a final solution but a workaround for testing EMDK application, during its development phases. It's hard for newbies, but it will make sense if you have prior knowledge of Instrumental Testing using JUNIT.

Instrumented Testing

//  Simulate a barcode being scanned
mockedInterface.AddScanData(“123456789”);
ScanDataCollection scanDataCollection = mockedInterface.ReportScan(success);

Pass Test Data

//  Trigger the data listener
activity.onData(scanDataCollection);

Check credibility of data

 //  Test that the correct data was scanned
onView(withId(R.id.textViewData)).check(matches(withText(”0123456789\n”)));

Github link to sample Project:
Github

Link to Original Source:
Original Source

huangapple
  • 本文由 发表于 2020年9月2日 17:22:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/63702551.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定