Android热更新 com.facebook.react.devsupport.JSException: SyntaxError: Unexpected end of script (/data/data/com.xxxxx/files/_update/lmJ1gQMQ3aidQg4gxZbxeDXcocY9/index.bundlejs:835)



  • android热更新的时候,碰到一个偶现的异常:
    com.facebook.react.devsupport.JSException: SyntaxError: Unexpected end of script (/data/data/com.diandianwalletapp/files/_update/lmJ1gQMQ3aidQg4gxZbxeDXcocY9/index.bundlejs:835)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
    at android.os.Looper.loop(Looper.java:194)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: com.facebook.jni.CppException: SyntaxError: Unexpected end of script (/data/data/com.diandianwalletapp/files/_update/lmJ1gQMQ3aidQg4gxZbxeDXcocY9/index.bundlejs:835)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
    at android.os.Handler.handleCallback(Handler.java:815) 
    at android.os.Handler.dispatchMessage(Handler.java:104) 
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
    at android.os.Looper.loop(Looper.java:194) 
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208) 
    at java.lang.Thread.run(Thread.java:818) 
    06-23 15:36:39.326 21567-21631/com.diandianwalletapp E/unknown:React: Exception in native call
    java.lang.RuntimeException: Error calling AppRegistry.runApplication
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
    at android.os.Looper.loop(Looper.java:194)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
    at android.os.Handler.handleCallback(Handler.java:815) 
    at android.os.Handler.dispatchMessage(Handler.java:104) 
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
    at android.os.Looper.loop(Looper.java:194) 
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208) 
    at java.lang.Thread.run(Thread.java:818)



  • 一般是因为bundle文件损坏了导致的。你是否可以校验bundle文件的正确性?如果可以的话建议在加载之前校验一下,校验失败就不要用这个bundle文件,然后将其删除,下次重新下载更新。


登录后回复