简体   繁体   English

我的应用程序在某些手机上无法运行,有时

[英]My app is not working in some phones and sometimes

I have developed an Android application while debugging it was worked properly and also it worked well in my phone.我在调试时开发了一个 Android 应用程序,它运行正常,并且在我的手机中运行良好。 But after sometime it was not working ( I didn't change any code).但是一段时间后它不起作用(我没有更改任何代码)。 In some phones it was working but some phones it was not working(app crashed after splash screen).在某些手机中它可以正常工作,但在某些手机中它无法正常工作(应用程序在启动画面后崩溃)。

I dont know what specifically is not working in your case, although there are many possible candidates for why your app works on specific phones and not on others :我不知道什么特别不适用于您的情况,尽管有很多可能的候选者可以解释为什么您的应用程序适用于特定手机而不适用于其他手机:

  1. The target android version used to develop the app does not include the one on a specific phone, which means that you could be using certain things only present in certain versions of Android.用于开发该应用程序的目标 Android 版本不包括特定手机上的版本,这意味着您可能会使用仅在某些 Android 版本中存在的某些内容。 As said by Rushguy23, check your build.gradle to see what version you are targeting.正如 Rushguy23 所说,检查您的 build.gradle 以查看您的目标版本。
  2. The app is using a lot of data at once, and certain more beefy phones can handle the data and others can't.该应用程序同时使用大量数据,某些功能更强大的手机可以处理这些数据,而其他手机则不能。 Images, music and videos can all be candidates in this case for why the app is crashing.在这种情况下,图像、音乐和视频都可以成为应用程序崩溃原因的候选对象。 If you are using a database, it would be good to use some kind of compression to store and get data from it.如果您使用的是数据库,最好使用某种压缩来存储和从中获取数据。

Those are the main things I could see for why you are having trouble on certain phones and not on others.这些是我可以看到的主要内容,为什么您在某些手机上遇到问题而不是在其他手机上。

The best practice i have is to lover minsdk version and lint your project.我的最佳实践是喜欢 minsdk 版本并检查您的项目。 Watch all warnings and made the code more clean for that warnings, or use another functions and methods that are supported on all targeted android versions.观看所有警告并针对这些警告使代码更干净,或者使用所有目标 android 版本支持的其他函数和方法。 Also i recommend to refactor support libraries to androidx.我还建议将支持库重构为 androidx。 And remove all deprecation warnings by usage of compat helpers.并通过使用 compat helper 删除所有弃用警告。 For example DrawableCompat, ViewCompat, ContextCompat, ... It will increase Your application success on most of devices.例如 DrawableCompat, ViewCompat, ContextCompat, ... 它会增加您在大多数设备上的应用程序成功率。 If it crash again, You can use some reporting tool like acra, or instabug & etc to get idea whats happen in Your app on affected device so far.如果它再次崩溃,您可以使用一些报告工具(如 acra 或 instabug 等)来了解到目前为止受影响设备上您的应用程序中发生了什么。 You can also use some gradle plugins to run application on more than one instance of emulator and run tests on any android version to test compatibility issues.您还可以使用一些 gradle 插件在多个模拟器实例上运行应用程序,并在任何 android 版本上运行测试以测试兼容性问题。

BR BR

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

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