我是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. 

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


当前回答

对我来说,这是RoundedBackgroundColorSpan !在textview中,我删除了它(燃烧我的大脑来找到它,因为它没有出现在像Pixel 4 Xl或三星note 10+这样的真实智能手机中,也没有出现在模拟器中,但在芯片设备中如此缓慢的视图)。

其他回答

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

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

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

我不是专家,但当我想从我的android应用程序发送数据到web服务器时,我得到了这个调试消息。虽然我使用AsyncTask类并在后台进行数据传输,但为了从服务器获取结果数据,我使用了AsyncTask类的get()方法,这使得UI同步,这意味着你的UI将等待太长时间。所以我的建议是让你的应用程序在一个单独的线程上执行每个面向网络的任务。

还没有解决,但会解决的。对于我的小项目,有一个可组合的功能(按钮)和逻辑来检查是否“com. com”。在启动模拟器时,我在相同的日志中有以下内容:

I/Choreographer: Skipped 34 frames!  The application may be doing too much work on its main thread.

我也有同样的问题。 我的是一个案例,我使用的背景图像是在绘图。这个特殊的图像大约有130kB,在我的android应用程序的启动画面和主页上使用。

解决方案-我只是把特定的图像从drawables转移到drawables-xxx文件夹,并且能够释放大量的内存占用在背景和跳绳帧不再跳绳。

更新使用“nodp”可绘制资源文件夹来存储背景可绘制图 文件。 密度限定的可绘制文件夹还是drawable-nodpi优先?