在 Developer Console 上收到了这个 ANR 报告,我觉得有点奇怪。好像是 File 的问题,但我不太确定,所以我希望有人能解释一下。非常感谢!
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=1)
"main" prio=5 tid=1 SUSPENDED
| group="main" sCount=1 dsCount=0 obj=0x40a4b460 self=0xa0f828
| sysTid=17417 nice=0 sched=0/0 cgrp=default handle=1074566280
| schedstat=( 10844308000 1221939000 8746 ) utm=972 stm=112 core=1
at java.io.File.fixSlashes(File.java:~197)
at java.io.File.<init>(File.java:134)
at java.io.File.getAbsoluteFile(File.java:387)
at com.miz.mizuu.UpdateMovieService.onStart(UpdateMovieService.java:179)
at android.app.Service.onStartCommand(Service.java:438)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
at android.app.ActivityThread.access$1900(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
"DispatcherThread" prio=5 tid=11 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41966bf8 self=0xe63280
| sysTid=17452 nice=0 sched=0/0 cgrp=default handle=14719552
| schedstat=( 280000 313000 4 ) utm=0 stm=0 core=0
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:118)
at android.os.Looper.loop(Looper.java:118)
at android.os.HandlerThread.run(HandlerThread.java:60)
"AsyncTask #5" prio=5 tid=17 WAIT
| group="main" sCount=1 dsCount=0 obj=0x417c7f48 self=0xd01db0
| sysTid=17440 nice=10 sched=0/0 cgrp=bg_non_interactive handle=13640192
| schedstat=( 22850000 93316000 69 ) utm=2 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x417c80b8> (a java.lang.VMThread) held by tid=17 (AsyncTask #5)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #4" prio=5 tid=16 WAIT
| group="main" sCount=1 dsCount=0 obj=0x417a2740 self=0xcff9b0
| sysTid=17439 nice=10 sched=0/0 cgrp=bg_non_interactive handle=13604208
| schedstat=( 39193000 106588000 94 ) utm=3 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x417a2878> (a java.lang.VMThread) held by tid=16 (AsyncTask #4)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #3" prio=5 tid=15 WAIT
| group="main" sCount=1 dsCount=0 obj=0x41774f28 self=0xcf3c48
| sysTid=17438 nice=10 sched=0/0 cgrp=bg_non_interactive handle=13521264
| schedstat=( 33842000 118576000 89 ) utm=3 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x41775060> (a java.lang.VMThread) held by tid=15 (AsyncTask #3)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #2" prio=5 tid=14 WAIT
| group="main" sCount=1 dsCount=0 obj=0x41758038 self=0xc1aa70
| sysTid=17437 nice=10 sched=0/0 cgrp=bg_non_interactive handle=12116520
| schedstat=( 28508000 73514000 90 ) utm=1 stm=1 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x41758170> (a java.lang.VMThread) held by tid=14 (AsyncTask #2)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #1" prio=5 tid=13 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4174c610 self=0xcdb768
| sysTid=17436 nice=10 sched=0/0 cgrp=bg_non_interactive handle=12394856
| schedstat=( 31306000 75384000 71 ) utm=3 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x4174c7c0> (a java.lang.VMThread) held by tid=13 (AsyncTask #1)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #2" prio=5 tid=12 WAIT
| group="main" sCount=1 dsCount=0 obj=0x41651430 self=0xccafa0
| sysTid=17434 nice=0 sched=0/0 cgrp=default handle=11708720
| schedstat=( 891000 182000 7 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x410c15b0> (a java.lang.VMThread) held by tid=12 (AsyncTask #2)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #1" prio=5 tid=10 WAIT
| group="main" sCount=1 dsCount=0 obj=0x410b2f88 self=0xc2c800
| sysTid=17430 nice=10 sched=0/0 cgrp=bg_non_interactive handle=12473264
| schedstat=( 453884000 188589000 1537 ) utm=35 stm=10 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x410ad570> (a java.lang.VMThread) held by tid=10 (AsyncTask #1)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"Binder Thread #2" prio=5 tid=9 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x410bddf0 self=0xbe3d70
| sysTid=17428 nice=0 sched=0/0 cgrp=default handle=12074328
| schedstat=( 10983000 40959000 78 ) utm=1 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"Binder Thread #1" prio=5 tid=8 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x410bb088 self=0xb9f1a8
| sysTid=17427 nice=0 sched=0/0 cgrp=default handle=12303632
| schedstat=( 14487000 37152000 88 ) utm=1 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"FinalizerWatchdogDaemon" daemon prio=5 tid=7 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x410b6dd8 self=0xbd3300
| sysTid=17426 nice=0 sched=0/0 cgrp=default handle=12494048
| schedstat=( 1417000 7766000 15 ) utm=0 stm=0 core=0
at java.lang.VMThread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:1031)
at java.lang.Thread.sleep(Thread.java:1013)
at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:213)
at java.lang.Thread.run(Thread.java:856)
"FinalizerDaemon" daemon prio=5 tid=6 WAIT
| group="main" sCount=1 dsCount=0 obj=0x410b6c80 self=0xc44500
| sysTid=17425 nice=0 sched=0/0 cgrp=default handle=12500952
| schedstat=( 19448000 5571000 36 ) utm=1 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x40a415d0> (a java.lang.ref.ReferenceQueue)
at java.lang....
最佳答案
ANR 似乎是 Service 运行超过 5 秒引起的。显然,一些用户必须处理大量文件。我通过将所有艰苦的工作转移到 AsyncTask 来解决它。
关于android - 有人可以阐明这个 ANR 日志吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9965535/
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta
查看Ruby的CSV库的文档,我非常确定这是可能且简单的。我只需要使用Ruby删除CSV文件的前三列,但我没有成功运行它。 最佳答案 csv_table=CSV.read(file_path_in,:headers=>true)csv_table.delete("header_name")csv_table.to_csv#=>ThenewCSVinstringformat检查CSV::Table文档:http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV/Table.html
我发现ActiveRecord::Base.transaction在复杂方法中非常有效。我想知道是否可以在如下事务中从AWSS3上传/删除文件:S3Object.transactiondo#writeintofiles#raiseanexceptionend引发异常后,每个操作都应在S3上回滚。S3Object这可能吗?? 最佳答案 虽然S3API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。该API不提供任何批量上传功能(通过PUT或POST),因此每个上传操作都是通过一个独立的API调用完成的
我正在阅读SandiMetz的POODR,并且遇到了一个我不太了解的编码原则。这是代码:classBicycleattr_reader:size,:chain,:tire_sizedefinitialize(args={})@size=args[:size]||1@chain=args[:chain]||2@tire_size=args[:tire_size]||3post_initialize(args)endendclassMountainBike此代码将为其各自的属性输出1,2,3,4,5。我不明白的是查找方法。当一辆山地自行车被实例化时,因为它没有自己的initialize方法
我们的git存储库中目前有一个Gemfile。但是,有一个gem我只在我的环境中本地使用(我的团队不使用它)。为了使用它,我必须将它添加到我们的Gemfile中,但每次我checkout到我们的master/dev主分支时,由于与跟踪的gemfile冲突,我必须删除它。我想要的是类似Gemfile.local的东西,它将继承从Gemfile导入的gems,但也允许在那里导入新的gems以供使用只有我的机器。此文件将在.gitignore中被忽略。这可能吗? 最佳答案 设置BUNDLE_GEMFILE环境变量:BUNDLE_GEMFI
我喜欢使用Textile或Markdown为我的项目编写自述文件,但是当我生成RDoc时,自述文件被解释为RDoc并且看起来非常糟糕。有没有办法让RDoc通过RedCloth或BlueCloth而不是它自己的格式化程序运行文件?它可以配置为自动检测文件后缀的格式吗?(例如README.textile通过RedCloth运行,但README.mdown通过BlueCloth运行) 最佳答案 使用YARD直接代替RDoc将允许您包含Textile或Markdown文件,只要它们的文件后缀是合理的。我经常使用类似于以下Rake任务的东西:
我想让一个yaml对象引用另一个,如下所示:intro:"Hello,dearuser."registration:$introThanksforregistering!new_message:$introYouhaveanewmessage!上面的语法只是它如何工作的一个例子(这也是它在thiscpanmodule中的工作方式。)我正在使用标准的rubyyaml解析器。这可能吗? 最佳答案 一些yaml对象确实引用了其他对象:irb>require'yaml'#=>trueirb>str="hello"#=>"hello"ir
当谈到运行时自省(introspection)和动态代码生成时,我认为ruby没有任何竞争对手,可能除了一些lisp方言。前几天,我正在做一些代码练习来探索ruby的动态功能,我开始想知道如何向现有对象添加方法。以下是我能想到的3种方法:obj=Object.new#addamethoddirectlydefobj.new_method...end#addamethodindirectlywiththesingletonclassclass这只是冰山一角,因为我还没有探索instance_eval、module_eval和define_method的各种组合。是否有在线/离线资
我可以在Azure网站上部署RubyonRails吗? 最佳答案 还没有。目前仅支持.NET和PHP。 关于ruby-on-rails-RubyonRails可以部署在Azure网站上吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/12964010/