`
hemowolf
  • 浏览: 151585 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

调用service静态方法抛RuntimeException问题

阅读更多

    假设有一个service类是 AbcSvr在其内有一个static方法供外调用启动自己。

    public static void startAbcSvr(Context ctx ) {
	      ctx.startService(new Intent(ctx, AbcSvr.class));
    }

   在某种情况下回抛出Exception

   Exception Ljava/lang/RuntimeException; thrown while initializing Lcom/XXXX/AbcSvr;
   

    应是Dalvik的一个bug。解决的办法是将startAbcSvr方法移动到其他类去即可。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics