我是Android SDK/API环境的新手。这是我第一次试着画一个图表。我尝试在模拟器上使用3个不同的免费库运行不同种类的示例代码,没有显示在布局屏幕上。日志猫正在重复如下信息:

 W/Trace(1378): Unexpected value from nativeGetEnabledTags: 0
 I/Choreographer(1378): Skipped 55 frames!  The application may be doing too much work on its main thread. 

当我运行一个与授权库的评估副本相关的示例代码时,这个问题并没有持续存在,图表也正常工作。


当前回答

我也有同样的问题。当我在另一台计算机上运行这段代码时,它工作得很好。然而,在我的系统上,它显示“应用程序可能在主线程上做了太多的工作”。

我通过重新启动Android工作室解决了我的问题[文件->无效缓存/重新启动->单击“无效并重新启动”]。

其他回答

尝试使用以下策略来提高应用程序的性能:

尽可能使用多线程编程。即使你的智能手机只有一个核(如果处理器有两个或更多核,线程可以在不同的核上运行),性能上的好处也是巨大的。让你的应用逻辑与UI分离是很有用的。使用Java线程,AsyncTask或IntentService。检查这个。 阅读并遵循Android开发网站的各种性能提示。检查在这里。

因为我首先最好使用SVG图像而不是所有其他类型的图像,如果不可能,使用一些图像处理工具(如Adobe Photoshop或Fotosizer)压缩所有PNG和JPG资源。最简单的方法之一是在线图像压缩工具,像这样,它帮助我把所有的图像文件减少到初始大小的50%。

this usually happens when you are executing huge processes in main thread. it's OK to skip frames less than 200. but if you have more than 200 skipped frames, it can slow down your application UI thread. what you can do is to do these processes in a new thread called worker thread and after that, when you want to access and do something with UI thread(ex: do something with views, findView etc...) you can use handler or runOnUiThread(I like this more) in order to display the processing results. this absolutely solves the problem. using worker threads are very useful or even must be used when it comes to this cases.

https://stacklearn.ir

在我的例子中,这是因为我不小心在一个方法上设置了一个断点。一旦我清除了它,消息就消失了,性能提高了很多。

我也有同样的问题。在我的情况下,我有2个嵌套的相对布局。RelativeLayout总是要做两个措施通过。如果你嵌套RelativeLayouts,你会得到一个指数测量算法。