How can you debug on a phone you don't own?

2019-03-20 18:46发布

问题:

I've released an app to the market. It seems to work fine on some devices, and have completely weird behaviour on others. It runs fine in a VM configured to match the setup of these devices.

In general though, given that some phones behave in unexpected ways, is there any other way of getting test data for certain devices without actually buying them? How do app developers fix problems that occur on a specific device?

回答1:

Ok you can take two approaches. The first approach is that you have a person operate your application in debug mode and they try to recreate the issue. The second approach is that you track the phones operations in the background constantly.

The first approach simply has you add an option in the application to start the debug mode. It writes the system logs to an additional text file and e-mails when the user sets it to. You'd have to persist this option in the event of the application crashing.

The second approach would be to either write the logs to a file during each application session and to purge the logs when the application is terminated. Or just write a certain amount of data to the application, purge the logs every so often.

You will need to either upload or e-mail the logs to your servers. This is straight forward enough.

To get the phone model check out http://developer.android.com/reference/android/os/Build.html#MODEL