taro-native-shell 壳子,android studio 启动报错,具体报错信息看内容。



  • 问题描述

    默认官方包,只修改了 moduleName 名字 ,xcode 可以正常启动。

    复现步骤

    默认官方包,只修改了 moduleName 名字

    期望行为

    解决此问题

    报错信息

    06/25 18:41:02: Launching app
    $ adb push /Users/bq-dn-zj-497/Documents/plain/taro/taro-native-shell/android/app/build/outputs/apk/app-debug.apk /data/local/tmp/com.tarodemo
    $ adb shell pm install -t -r "/data/local/tmp/com.tarodemo"
    Success
    APK installed in 8 s 736 ms
    $ adb shell am start -n "com.tarodemo/com.tarodemo.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
    Client not ready yet..Waiting for process to come online
    Connected to process 5463 on device emulator-5554
    Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
    V/fb-UnpackingSoSource: locked dso store /data/user/0/com.tarodemo/lib-main
    V/fb-UnpackingSoSource: deps mismatch on deps store: regenerating
        so store dirty: regenerating
    D/ApkSoSource: not allowing consideration of lib/x86/libfb.so: deferring to libdir
        not allowing consideration of lib/x86/libfolly_json.so: deferring to libdir
        not allowing consideration of lib/x86/libglog.so: deferring to libdir
        not allowing consideration of lib/x86/libglog_init.so: deferring to libdir
    D/ApkSoSource: not allowing consideration of lib/x86/libgnustl_shared.so: deferring to libdir
        not allowing consideration of lib/x86/libicu_common.so: deferring to libdir
        not allowing consideration of lib/x86/libimagepipeline.so: deferring to libdir
        not allowing consideration of lib/x86/libjsc.so: deferring to libdir
    D/ApkSoSource: not allowing consideration of lib/x86/libprivatedata.so: deferring to libdir
        not allowing consideration of lib/x86/libreactnativejni.so: deferring to libdir
        not allowing consideration of lib/x86/libyoga.so: deferring to libdir
    V/fb-UnpackingSoSource: regenerating DSO store com.facebook.soloader.ApkSoSource
    V/fb-UnpackingSoSource: starting syncer worker
    V/fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.tarodemo/lib-main (from syncer thread)
        not releasing dso store lock for /data/user/0/com.tarodemo/lib-main (syncer thread started)
    D/ReactNative: ReactInstanceManager.ctor()
    D/NetworkSecurityConfig: No Network Security Config specified, using platform default
    D/ReactNative: ReactInstanceManager.createReactContextInBackground()
        ReactInstanceManager.recreateReactContextInBackgroundInner()
    D/OpenGLRenderer: HWUI GL Pipeline
    D/: HostConnection::get() New Host Connection established 0xd937d600, tid 5503
    I/OpenGLRenderer: Initialized EGL, version 1.4
    D/OpenGLRenderer: Swap behavior 1
    W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    D/OpenGLRenderer: Swap behavior 0
    D/EGL_emulation: eglCreateContext: 0xdd884420: maj 3 min 0 rcv 3
    D/EGL_emulation: eglMakeCurrent: 0xdd884420: ver 3 0 (tinfo 0xdd8833b0)
    W/unknown:ReactNative: Could not parse DebugServerException from: {"message":"Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{"description":"Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]"}],"stack":"NotFoundError: Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]\n    at DependencyGraph.getAbsolutePath (/Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/node-haste/DependencyGraph.js:317:11)\n    at /Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:280:416\n    at Generator.next (<anonymous>)\n    at step (/Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:445)\n    at /Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:605\n    at process._tickCallback (internal/process/next_tick.js:68:7)"}
        org.json.JSONException: No value for filename
            at org.json.JSONObject.get(JSONObject.java:392)
            at org.json.JSONObject.getString(JSONObject.java:553)
            at com.facebook.react.common.DebugServerException.parse(DebugServerException.java:65)
            at com.facebook.react.devsupport.BundleDownloader.processBundleResult(BundleDownloader.java:257)
            at com.facebook.react.devsupport.BundleDownloader.access$200(BundleDownloader.java:35)
            at com.facebook.react.devsupport.BundleDownloader$1.onResponse(BundleDownloader.java:153)
            at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
            at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
            at java.lang.Thread.run(Thread.java:764)
    E/unknown:ReactNative: Unable to download JS bundle
        com.facebook.react.common.DebugServerException: The development server returned response error code: 404
        
        URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
        
        Body:
        {"message":"Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{"description":"Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]"}],"stack":"NotFoundError: Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]\n    at DependencyGraph.getAbsolutePath (/Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/node-haste/DependencyGraph.js:317:11)\n    at /Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:280:416\n    at Generator.next (<anonymous>)\n    at step (/Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:445)\n    at /Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:605\n    at process._tickCallback (internal/process/next_tick.js:68:7)"}
            at com.facebook.react.devsupport.BundleDownloader.processBundleResult(BundleDownloader.java:266)
            at com.facebook.react.devsupport.BundleDownloader.access$200(BundleDownloader.java:35)
            at com.facebook.react.devsupport.BundleDownloader$1.onResponse(BundleDownloader.java:153)
            at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
            at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
            at java.lang.Thread.run(Thread.java:764)
    W/unknown:InspectorPackagerConnection: Couldn't connect to packager, will silently retry
    D/EGL_emulation: eglMakeCurrent: 0xdd884420: ver 3 0 (tinfo 0xdd8833b0)
    D/EGL_emulation: eglMakeCurrent: 0xdd884420: ver 3 0 (tinfo 0xdd8833b0)
    E/unknown:ReactNative: Exception in native call
        com.facebook.react.common.DebugServerException: The development server returned response error code: 404
        
        URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
        
        Body:
        {"message":"Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{"description":"Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]"}],"stack":"NotFoundError: Cannot find entry file index.js in any of the roots: [\"/Users/bq-dn-zj-497/Documents/plain/taro/demo\"]\n    at DependencyGraph.getAbsolutePath (/Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/node-haste/DependencyGraph.js:317:11)\n    at /Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:280:416\n    at Generator.next (<anonymous>)\n    at step (/Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:445)\n    at /Users/bq-dn-zj-497/Documents/plain/taro/demo/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:605\n    at process._tickCallback (internal/process/next_tick.js:68:7)"}
            at com.facebook.react.devsupport.BundleDownloader.processBundleResult(BundleDownloader.java:266)
            at com.facebook.react.devsupport.BundleDownloader.access$200(BundleDownloader.java:35)
            at com.facebook.react.devsupport.BundleDownloader$1.onResponse(BundleDownloader.java:153)
            at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
            at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
            at java.lang.Thread.run(Thread.java:764)
    D/EGL_emulation: eglMakeCurrent: 0xdd884420: ver 3 0 (tinfo 0xdd8833b0)
    I/zygote: Do partial code cache collection, code=29KB, data=26KB
        After code cache collection, code=29KB, data=26KB
        Increasing code cache capacity to 128KB
    I/zygote: Do partial code cache collection, code=58KB, data=47KB
    I/zygote: After code cache collection, code=58KB, data=47KB
        Increasing code cache capacity to 256KB
    I/zygote: Background concurrent copying GC freed 34127(2MB) AllocSpace objects, 3(76KB) LOS objects, 67% free, 749KB/2MB, paused 29.945ms total 208.595ms
    Device emulator-5554disconnected, monitoring stopped.
    

    系统信息

    Taro v1.3.4
    
    Taro CLI 1.3.4 environment info:
    System:
    OS: macOS 10.14
    Shell: 5.3 - /bin/zsh
    Binaries:
    Node: 10.15.3 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    npmPackages:
    @tarojs/async-await: 1.3.4 => 1.3.4
    @tarojs/components: 1.3.4 => 1.3.4
    @tarojs/components-rn: 1.3.4 => 1.3.4
    @tarojs/plugin-babel: 1.3.4 => 1.3.4
    @tarojs/plugin-csso: 1.3.4 => 1.3.4
    @tarojs/plugin-sass: 1.3.4 => 1.3.4
    @tarojs/plugin-uglifyjs: 1.3.4 => 1.3.4
    @tarojs/redux: 1.3.4 => 1.3.4
    @tarojs/redux-h5: 1.3.4 => 1.3.4
    @tarojs/router: 1.3.4 => 1.3.4
    @tarojs/taro: 1.3.4 => 1.3.4
    @tarojs/taro-alipay: 1.3.4 => 1.3.4
    @tarojs/taro-h5: 1.3.4 => 1.3.4
    @tarojs/taro-redux-rn: 1.3.4 => 1.3.4
    @tarojs/taro-rn: 1.3.4 => 1.3.4
    @tarojs/taro-router-rn: 1.3.4 => 1.3.4
    @tarojs/taro-swan: 1.3.4 => 1.3.4
    @tarojs/taro-tt: 1.3.4 => 1.3.4
    @tarojs/taro-weapp: 1.3.4 => 1.3.4
    @tarojs/webpack-runner: 1.3.4 => 1.3.4
    eslint-config-taro: 1.3.4 => 1.3.4
    eslint-plugin-taro: 1.3.4 => 1.3.4
    nerv-devtools: ^1.4.3 => 1.4.3
    nervjs: ^1.4.3 => 1.4.3
    react: 16.3.1 => 16.3.1
    react-native: 0.55.4 => 0.55.4
    


  • 1.3+ Metro Server 是在 工程目录下启动的(暂时没有找到合适的方式自动打开终端且在 rn_temp 下启动 Metro Server),而 index.js 入口文件在 rn_temp 下,因此安卓会找不到。

    临时解决方案

    关闭自动唤起的 Metro Server ,在项目根目录手动运行:react-native start --root 项项目绝对路径/rn_temp ,会看到一下内容:

    image

    正在积极寻找安卓和 iOS 通用的解决方案。


登录后回复