jjzjj

android - "java.lang.RuntimeException: Could not launch intent"用于具有不确定 ProgressBar 的 UI

coder 2023-12-23 原文

使用 AndroidJUnitRunner 显示不确定的 ProgressBar 是否存在任何已知问题?我在测试期间遇到了这个错误:

05-26 15:22:48.504    1003-1016/? I/TestRunner﹕ java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.cookbrite.dev/com.cookbrite.ui.HomeListActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1432668122421 and now the last time the queue went idle was: 1432668122421. If these numbers are the same your activity might be hogging the event queue.

堆栈跟踪是:

05-26 15:22:48.504    1003-1016/? I/TestRunner﹕ java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.cookbrite.dev/com.cookbrite.ui.HomeListActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1432668122421 and now the last time the queue went idle was: 1432668122421. If these numbers are the same your activity might be hogging the event queue.
            at android.support.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:274)
            at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:119)
            at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)
            at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)
            at com.cookbrite.step2_functional.ui.homelist.HomeListFragmentLoadingTest.testLoadingSpinner(HomeListFragmentLoadingTest.java:40)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
            at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
            at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
            at com.cookbrite.util.BaseBlackBoxTest.doRunTest(BaseBlackBoxTest.java:300)
            at com.cookbrite.util.BaseBlackBoxTest.access$000(BaseBlackBoxTest.java:44)
            at com.cookbrite.util.BaseBlackBoxTest$1.call(BaseBlackBoxTest.java:271)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)

由上述超时触发的线程转储显示 ProgressBar 似乎涉及:

05-26 15:22:48.135    1003-1018/? E/THREAD_STATE﹕ Thread[main,5,main]
    android.graphics.Canvas.native_drawBitmap(Native Method)
    android.graphics.Canvas.drawBitmap(Canvas.java:1160)
    android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:440)
    android.graphics.drawable.RotateDrawable.draw(RotateDrawable.java:88)
    android.graphics.drawable.LayerDrawable.draw(LayerDrawable.java:345)
    android.widget.ProgressBar.onDraw(ProgressBar.java:1052)
    android.view.View.draw(View.java:13944)
    android.view.View.draw(View.java:13825)
    android.view.ViewGroup.drawChild(ViewGroup.java:3086)
    android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923)
    android.view.View.draw(View.java:13823)
    android.view.ViewGroup.drawChild(ViewGroup.java:3086)
    android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923)
    android.view.View.draw(View.java:13947)
    android.view.View.draw(View.java:13825)
    android.view.ViewGroup.drawChild(ViewGroup.java:3086)
    android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923)
    android.view.View.draw(View.java:13823)
    android.view.ViewGroup.drawChild(ViewGroup.java:3086)
    android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923)
    android.view.View.draw(View.java:13947)
    android.widget.FrameLayout.draw(FrameLayout.java:467)
    android.view.View.draw(View.java:13825)
    android.view.ViewGroup.drawChild(ViewGroup.java:3086)
    android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923)
    android.view.View.draw(View.java:13823)
    android.view.ViewGroup.drawChild(ViewGroup.java:3086)
    android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923)
    android.view.View.draw(View.java:13947)
    android.widget.FrameLayout.draw(FrameLayout.java:467)
    com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2224)
    android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2482)
    android.view.ViewRootImpl.draw(ViewRootImpl.java:2395)
    android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2239)
    android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1872)
    android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
    android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
    android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
    android.view.Choreographer.doCallbacks(Choreographer.java:562)
    android.view.Choreographer.doFrame(Choreographer.java:532)
    android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
    android.os.Handler.handleCallback(Handler.java:730)
    android.os.Handler.dispatchMessage(Handler.java:92)
    android.os.Looper.loop(Looper.java:137)
    android.app.ActivityThread.main(ActivityThread.java:5103)
    java.lang.reflect.Method.invokeNative(Native Method)
    java.lang.reflect.Method.invoke(Method.java:525)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    dalvik.system.NativeStart.main(Native Method)
    Thread[Binder_2,5,main]
    dalvik.system.NativeStart.run(Native Method)
    Thread[JDWP,5,system]
    dalvik.system.NativeStart.run(Native Method)
    Thread[pool-1-thread-1,5,main]
    java.lang.Object.wait(Native Method)
    java.lang.Object.wait(Object.java:364)
    android.app.Instrumentation.startActivitySync(Instrumentation.java:403)
    android.support.test.runner.MonitoringInstrumentation.access$101(MonitoringInstrumentation.java:69)
    android.support.test.runner.MonitoringInstrumentation$3.call(MonitoringInstrumentation.java:265)
    android.support.test.runner.MonitoringInstrumentation$3.call(MonitoringInstrumentation.java:262)
    java.util.concurrent.FutureTask.run(FutureTask.java:234)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    java.lang.Thread.run(Thread.java:841)
    Thread[pool-5-thread-1,5,main]
    dalvik.system.VMStack.getThreadStackTrace(Native Method)
    java.lang.Thread.getStackTrace

最佳答案

我认为您实际上无法测试进度条以查看它们是否完成。

我们使用进度条只是作为一种方式来显示我们在时间上有多远(例如,30 天周期中的第 7 天,所以我们的进度条从未完成)。为了避免这个问题,我们不得不为我们的应用程序使用不同的 API 级别。我们似乎只在 API 级别为 21 的模拟器上遇到这个问题。一旦我们将模拟器切换到 API 级别 19,我们的测试就成功了。

注意:我们在为测试更改带有简单 View 的进度条方面也取得了一些成功,但我们认为这比我们喜欢的更 hacky。

关于android - "java.lang.RuntimeException: Could not launch intent"用于具有不确定 ProgressBar 的 UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30469240/

有关android - "java.lang.RuntimeException: Could not launch intent"用于具有不确定 ProgressBar 的 UI的更多相关文章

  1. ruby - i18n Assets 管理/翻译 UI - 2

    我正在使用i18n从头开始​​构建一个多语言网络应用程序,虽然我自己可以处理一大堆yml文件,但我说的语言(非常)有限,最终我想寻求外部帮助帮助。我想知道这里是否有人在使用UI插件/gem(与django上的django-rosetta不同)来处理多个翻译器,其中一些翻译器不愿意或无法处理存储库中的100多个文件,处理语言数据。谢谢&问候,安德拉斯(如果您已经在ruby​​onrails-talk上遇到了这个问题,我们深表歉意) 最佳答案 有一个rails3branchofthetolkgem在github上。您可以通过在Gemfi

  2. ruby-on-rails - rails : "missing partial" when calling 'render' in RSpec test - 2

    我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou

  3. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  4. ruby - 具有身份验证的私有(private) Ruby Gem 服务器 - 2

    我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..

  5. ruby-on-rails - Rails 常用字符串(用于通知和错误信息等) - 2

    大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje

  6. ruby - 检查 "command"的输出应该包含 NilClass 的意外崩溃 - 2

    为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar

  7. java - 等价于 Java 中的 Ruby Hash - 2

    我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/

  8. ruby-on-rails - 迷你测试错误 : "NameError: uninitialized constant" - 2

    我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test

  9. Ruby Sinatra 配置用于生产和开发 - 2

    我已经在Sinatra上创建了应用程序,它代表了一个简单的API。我想在生产和开发上进行部署。我想在部署时选择,是开发还是生产,一些方法的逻辑应该改变,这取决于部署类型。是否有任何想法,如何完成以及解决此问题的一些示例。例子:我有代码get'/api/test'doreturn"Itisdev"end但是在部署到生产环境之后我想在运行/api/test之后看到ItisPROD如何实现? 最佳答案 根据SinatraDocumentation:EnvironmentscanbesetthroughtheRACK_ENVenvironm

  10. ruby-on-rails - 相关表上的范围为 "WHERE ... LIKE" - 2

    我正在尝试从Postgresql表(table1)中获取数据,该表由另一个相关表(property)的字段(table2)过滤。在纯SQL中,我会这样编写查询:SELECT*FROMtable1JOINtable2USING(table2_id)WHEREtable2.propertyLIKE'query%'这工作正常:scope:my_scope,->(query){includes(:table2).where("table2.property":query)}但我真正需要的是使用LIKE运算符进行过滤,而不是严格相等。然而,这是行不通的:scope:my_scope,->(que

随机推荐