野火🔥

React Native 0.30 Android出现Didn't find class "com.facebook.jni.IteratorHelper...

2016/07/25

React Native 0.30 Android出现Didn’t find class “com.facebook.jni.IteratorHelper”错误

错误堆栈及解决办法

错误堆栈

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
E/unknown:React( 7231): Exception in native call from JS
E/unknown:React( 7231): java.lang.ClassNotFoundException: Didn't find class "com.facebook.jni.IteratorHelper" on path: DexPathList[[zip file "/data/app/com.silklabs.bla.example-1/base.apk"],nativeLibraryDirectories=[/data/app/com.silklabs.bla.example-1/lib/x86, /vendor/lib, /system/lib]]
E/unknown:React( 7231): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/unknown:React( 7231): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/unknown:React( 7231): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/unknown:React( 7231): at com.facebook.react.cxxbridge.ModuleRegistryHolder.initHybrid(Native Method)
E/unknown:React( 7231): at com.facebook.react.cxxbridge.ModuleRegistryHolder.<init>(ModuleRegistryHolder.java:26)
E/unknown:React( 7231): at com.facebook.react.cxxbridge.NativeModuleRegistry.getModuleRegistryHolder(NativeModuleRegistry.java:63)
E/unknown:React( 7231): at com.facebook.react.cxxbridge.CatalystInstanceImpl.<init>(CatalystInstanceImpl.java:106)
E/unknown:React( 7231): at com.facebook.react.cxxbridge.CatalystInstanceImpl.<init>(CatalystInstanceImpl.java:50)
E/unknown:React( 7231): at com.facebook.react.cxxbridge.CatalystInstanceImpl$Builder.build(CatalystInstanceImpl.java:484)
E/unknown:React( 7231): at com.facebook.react.XReactInstanceManagerImpl.createReactContext(XReactInstanceManagerImpl.java:860)
E/unknown:React( 7231): at com.facebook.react.XReactInstanceManagerImpl.access$600(XReactInstanceManagerImpl.java:103)
E/unknown:React( 7231): at com.facebook.react.XReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(XReactInstanceManagerImpl.java:203)
E/unknown:React( 7231): at com.facebook.react.XReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(XReactInstanceManagerImpl.java:182)
E/unknown:React( 7231): at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/unknown:React( 7231): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/unknown:React( 7231): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/unknown:React( 7231): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/unknown:React( 7231): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/unknown:React( 7231): at java.lang.Thread.run(Thread.java:818)
E/unknown:React( 7231): Suppressed: java.lang.ClassNotFoundException: com.facebook.jni.IteratorHelper
E/unknown:React( 7231): at java.lang.Class.classForName(Native Method)
E/unknown:React( 7231): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/unknown:React( 7231): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/unknown:React( 7231): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/unknown:React( 7231): ... 17 more
E/unknown:React( 7231): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

解决办法

在初始化ReactInstanceManager中,增加build方法 .setUseOldBridge(true) 即可。

错误原因

com.facebook.jni.IteratorHelper 为 0.31-rc 的class,暂时不能使用。facebook又把半成品给小白鼠体验了

CATALOG
  1. 1. React Native 0.30 Android出现Didn’t find class “com.facebook.jni.IteratorHelper”错误
    1. 1.1. 错误堆栈及解决办法
    2. 1.2. 错误原因