简体   繁体   English

在Galaxy S5中调试应用程序

[英]Debug App in Galaxy S5

I am building an Android app for my company, using Android Studio 1.5.1 . 我正在使用Android Studio 1.5.1为我的公司构建一个Android应用程序。 I've discovered that the app won't work on some Galaxy S5 phones. 我发现该应用程序无法在某些 Galaxy S5手机上运行。

These phones just show a white screen when the app runs. 当应用运行时,这些手机只显示白屏。 This error happens on Galaxy S5 devices with Android version 5.1.1 But not on an Galaxy S5 Device running Android version 5.0 在使用Android版本5.1.1的Galaxy S5设备上会出现此错误,但在运行Android 5.0版本的Galaxy S5设备上则不会

I'm focusing on the Android Version as a clue to solving this bug. 我专注于Android版本作为解决此错误的线索。 I can't actually get one of the devices so I've created several Virtual Devices. 我实际上无法获得其中一个设备,所以我创建了几个虚拟设备。 There are 6 Downloadable system images of Android 5.1.1 in Android Studio's Virtual Device Configuration wizard. Android Studio的虚拟设备配置向导中有6个Android 5.1.1的可下载系统映像。 I've installed all of them. 我安装了所有这些。 none replicate this white screen error. 没有复制此白屏错误。

What else can I do to uncover this bug? 我还能做些什么来发现这个bug?

If it helps answer my question, my app relies heavily on server communication. 如果它有助于回答我的问题,我的应用很大程度上依赖于服务器通信。 The whole app is just one Webview with a few html & JS files. 整个应用程序只是一个带有几个htmlJS文件的Webview

The problem with emulators is that they are not reproducing actual device behaviour (especially, once many OEMs like Samsung tend to customise Android based on their needs), so I'm afraid the only options you have are: 仿真器的问题在于它们不能再现实际的设备行为 (特别是,像三星这样的许多OEM倾向于根据自己的需求定制Android),所以我担心你唯一的选择是:

  1. Get Samsung Galaxy S5 with 5.1.1 三星Galaxy S5搭配5.1.1

    Apart from obvious ideas "go to shop and buy", I can recommend you: 除了明显的想法“去购物和购买”,我可以推荐你:

    • to take a look at Open Device Lab . 看一下Open Device Lab It operates around the world and there's an arguably good chance to find the device you need there; 它在世界各地运营,有一个很好的机会找到你需要的设备;
    • build a pool of alpha-beta users you can talk to and share new builds. 建立一个alpha-beta用户池,您可以与他们交谈并分享新版本。 Google Play has quite rich functionality in this area. Google Play在此领域拥有相当丰富的功能。 Samsung S5 is quite common model, so it shouldn't be a problem to find people with it. 三星S5是一个相当普遍的型号,所以找到它的人不应该是一个问题。 If your product is "public", you can try to find beta-users on services like BetaBound or just among your social media network; 如果您的产品是“公开的”,您可以尝试在BetaBound等服务上找到测试用户,或者只是在您的社交媒体网络中找到测试用户;
  2. Use Analytics tools to collect more data from affected devices and act based on the information you get 使用Google Analytics工具从受影响的设备收集更多数据,并根据您获得的信息采取行动

    There're dozens of different frameworks for accomplishing it. 有许多不同的框架来完成它。 I can suggest Crittercism as a super powerful and comprehensive tool. 我可以将Crittercism建议为一个超级强大而全面的工具。 In particular, I'd definitely log: 特别是,我肯定会记录:

    • All handled exceptions 所有处理的异常
    • Add breadcrumbs (short string to capture app run-time information) to all Activity / Fragment lifecycle methods, to Application 's methods (as white screen on start might mean some issues there), to all meaningful async tasks, etc. 添加面包屑(短字符串以捕获应用程序运行时信息)到所有Activity / Fragment生命周期方法,到Application的方法(如启动时的白屏可能意味着某些问题),所有有意义的异步任务等。
    • If app gets into suspicion state - log it as a handled exception, so you can see the whole trail of breadcrumbs and track history of exceptions for the user. 如果应用程序进入怀疑状态 - 将其记录为已处理的异常,那么您可以查看面包屑的整个跟踪并跟踪用户的异常历史记录。 Unfortunately, you won't get trail of breadcrumbs, before something has been logged as an issue (crash or exception). 不幸的是,在将某些内容记录为问题(崩溃或异常)之前,您将无法获得痕迹痕迹。 There're frameworks, which log everything, like MixPanel , for example, but I honestly think that Crittercism suits much more here) 有框架,记录所有内容,例如MixPanel ,但我真的认为Crittercism更适合这里)

    Crittercism will also catch & report all crashes happen in the app and Crittercism还将捕获并报告应用程序中发生的所有崩溃

    The Get Started Guide is here and it's pretty straightforward: http://docs.crittercism.com/android/android.html 入门指南就在这里,非常简单: http//docs.crittercism.com/android/android.html

Saying that, I'd suggest you to integrate some analytics anyway, as it'll help you in the future and to try to get affected phone in hands for test. 这么说,我建议你无论如何都要集成一些分析,因为它将来会帮助你,并试图让受影响的手机进行测试。

I guess the culprit is webview. 我猜罪魁祸首是webview。 Can you check the webview version on which the issue is reproducible. 您可以查看问题可重现的webview版本吗?

To check the version you need to go to settings->Application Manager-> Downloaded Apps-> check "Android System Webview"version 要检查版本,您需要转到设置 - >应用程序管理器 - >下载的应用程序 - >选中“Android系统Webview”版本

We had a similar issue when the screen used to go blank and it used to happen only on particular version of webview. 当屏幕空白时,我们遇到了类似的问题,过去只在特定版本的webview上发生。 The issue was fixed by Google later. 此问题已由Google修复。

The chromium webview layer is now updatable from Google Play. Chrome webview图层现在可以从Google Play更新。

For more details refer- http://developer.android.com/about/versions/lollipop.html#WebView 有关详细信息,请参阅http://developer.android.com/about/versions/lollipop.html#WebView

I assume you are building a hybrid app. 我假设你正在构建一个混合应用程序。

If the webview is the culprit, you could try crosswalk . 如果webview是罪魁祸首,你可以尝试人行横道 It adds Mb's to your app but it makes sure every device uses the same webview (latest chromium). 它将Mb添加到您的应用程序,但它确保每个设备使用相同的webview(最新的铬)。 Moreover rendering differences etc are also minimized. 此外,渲染差异等也被最小化。

if you are using cordova run: cordova plugin add cordova-plugin-crosswalk-webview and that's it. 如果你正在使用cordova run:cordova插件添加cordova-plugin-crosswalk-webview就是这样。

If you implement this and the whitescreen problem is gone, you debugged it in a sherlock holmish deduction way... 如果你实现这个并且白屏问题消失了,你用sherlock holmish演绎方式调试它...

The problem is not with emulator. 问题不在于模拟器。 It is with WebView in Android versions 5.1 onward . 它是Android版本5.1 onward WebView

Try 尝试

uninstalling the updates for "Android system webview" app (go to settings and look for it under "downloaded") it works just fine! 卸载“Android系统webview”应用程序的更新(转到设置并在“已下载”下查找)它运行正常!

Source - similar question 来源 - 类似的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM