Giter Club home page Giter Club logo

react-native-multibundler's Issues

安卓打包release空指针

RN拆包,debug是完全OK的,但是release爆了空指针异常,大概是什么问题呢?

java.lang.NullPointerException: java.lang.NullPointerException
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2911)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1680)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6707)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
     Caused by: java.lang.NullPointerException: java.lang.NullPointerException
        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromFile(Native Method)
        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromFile(CatalystInstanceImpl.java:224)
        at club.fromfactory.baselibrary.utils.RNScriptLoadUtil.loadFile(RNScriptLoadUtil.java:78)
        at club.fromfactory.baselibrary.utils.RNScriptLoadUtil.loadScriptFromFile(RNScriptLoadUtil.java:54)

iOS工程跑不起来

▸ Copying /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h
▸ Compiling PrivateDataBase.cpp
▸ Analyzing PrivateDataBase.cpp
▸ Building library libprivatedata.a
▸ Running script 'Install Third Party'
▸ Compiling fast-dtoa.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc'

▸ Compiling double-conversion.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/double-conversion.cc'

▸ Compiling fixed-dtoa.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc'

▸ Compiling strtod.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'

▸ Compiling diy-fp.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/diy-fp.cc'

▸ Compiling cached-powers.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc'

▸ Compiling bignum.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum.cc'

▸ Compiling bignum-dtoa.cc

❌ error: Build input file cannot be found: '/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum-dtoa.cc'

** BUILD FAILED **

The following build commands failed:

CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fast-dtoa.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/double-conversion.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/double-conversion.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fixed-dtoa.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/strtod.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/diy-fp.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/diy-fp.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/cached-powers.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/bignum.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/ryan/Downloads/react-native-multibundler-master/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/bignum-dtoa.o /Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

(8 failures)

Installing build/Build/Products/Debug-iphonesimulator/reactnative_multibundler.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/reactnative_multibundler.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/reactnative_multibundler.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

at checkExecSyncError (child_process.js:603:11)
at Object.execFileSync (child_process.js:621:13)
at Promise.then (/Users/ryan/Downloads/react-native-multibundler-master/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
at process._tickCallback (internal/process/next_tick.js:68:7)

0.6有bug么

hi,大佬,请教一下这个现在06有问题么? 是否测试过啊,还更新么?

如何判断某个页面属于哪个业务包?

你好,有个问题请教一下。

在有多个业务包的情况下,每个业务包内都有几个页面,那么如何判断某个页面属于哪个业务包?这样根据要进入页面加载对应的业务包。按Demo的做法是在原生侧写死了业务包和对应的页面,这样会限制在js侧动态添加、删除页面,是否能支持在打开RN页面之前,先从js侧读取最新的业务包-页面对应表,然后再加载对应的业务包?

业务包打包依赖问题,使用react-navigation@x3出现的问题

界面就是一个简单的跳转
然后根据文档进行分包操作,通过buz-ui.config.js,命令行进行打包,相继出现找不到第三方包的错,通过issues找到添加对应的第三方依赖
QQ图片20190327164513
之后重新打包,出现以下的错误
image,不知道什么原因

platformDep.js

var _ = require('lodash');
Text.render = _.wrap(Text.render, function (func, ...args) {
let originText = func.apply(this, args)
return React.cloneElement(originText, {allowFontScaling: false})
})

请问platformDep.js中这段代码的作用是什么?望不吝赐教

demo 打业务Bundle问题

node ./node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ --config /{你的绝对路径}/buz57.config.js

将 index 都换成 index3 打包出来的 包大小不对, 运行报错

debug release 打包依赖库问题

package.json

{
"name": "App",
"version": "5.3.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
},
"dependencies": {
"club-rn-base": "^3.0.1"
},
"devDependencies": {
"babel-jest": "22.4.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-preset-react-native": "4.0.0",
"eslint": "^5.7.0",
"jest": "22.4.2",
"metro-react-native-babel-preset": "^0.52.0",
"react-test-renderer": "16.0.0",
"redux-logger": "^3.0.6"
},
"jest": {
"preset": "react-native"
}
}

基础包
"bundle-ios-platform": "node ./node_modules/react-native/local-cli/cli.js bundle --platform ios --dev false --entry-file platformDep.js --bundle-output ios/bundle/platform.jsbundle --assets-dest ./ios/ --config $(pwd)/platform57.config.js",

业务包
"bundle-ios-buz": "node ./node_modules/react-native/local-cli/cli.js bundle --platform ios --dev false --entry-file index.js --bundle-output ios/bundle/buz.jsbundle --assets-dest ./ios/ --config $(pwd)/buz57.config.js",

其中基础包配置 platformEmptyDefaultExport.js 中 必须要
import 'redux-logger'
因为业务包里用到了这个库,但这个库本应该在dev中,虽然业务包脚本指定了 --dev false,但为什么业务包中还是会用到呢?
我的理解是 如果指定 --dev false, 那么打包的时候会略过。
可能是因为现在业务包的配置没能忽略 devDependencies, 如果是这样,怎么配置忽略 devDependencies?

热更新问题

使用codepush热更新,更新完的assets中的图片无法加载,怎么解决跨域问题

打包配置

希望大神就基础包打包配置,和业务包打包配置有更详细的说明和演示,比如加入第三方组件时要怎么配置?

android studio编译出错

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.facebook.fresco:fresco:1.10.0: Skipped due to earlier error

找不到com.facebook.react.devsupport.JSException: Can't find variable: __d

Process: com.yuebaoxiaov2, PID: 31654
java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Can't find variable: __d
at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:22)
at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:170)
at com.facebook.react.bridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:547)
at com.facebook.react.bridge.CatalystInstanceImpl.access$1000(CatalystInstanceImpl.java:44)
at com.facebook.react.bridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:563)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:148)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:818)
Caused by: com.facebook.react.devsupport.JSException: Can't find variable: __d
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:148) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192) 
at java.lang.Thread.run(Thread.java:818) 
Caused by: com.facebook.jni.CppException: Can't find variable: __d

global [email protected]:2:4

基础包用--dev true 打出的包运行会报错

node ./node_modules/react-native/local-cli/cli.js bundle --platform ios --dev true --entry-file platformDep.js --bundle-output ./ios/platform.ios.bundle --assets-dest ./ios/ --config {绝对路径}/platform57.config.js
--dev 改成true,打出的基础包,iOS加载会报错,如下图:
image

Redux在分包中怎么使用的呢?

谢谢大神分享的代码O(∩_∩)O
我的项目中使用了Redux,分包的时候是共用一份store吗?
还是建多个store,各用各的?
其中有一个reducer是用来做主题颜色切换的,所有的业务包都需要用到,这样的话只能共用一个store才能做到了。有没有更好的方式呢?

监测基础包何时完全加载完成

  • (instancetype)initWithBundleURL:(NSURL *)bundleURL
    moduleProvider:(RCTBridgeModuleListProvider)block
    launchOptions:(NSDictionary *)launchOptions
    大神指导怎么监测基础包何时完全加载完成么?
    我如果加载完基础包,立即加载业务包,会报错,加个延时就可以,之所以重新加载基础包,是因为这样相同的业务包名文件就可以刷新
    appDelegate.bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
    moduleProvider:nil
    launchOptions:appDelegate.launchOptions];
    [appDelegate.bridge.batchedBridge executeSourceCode:sourceBuz sync:YES];

只能加载一个bundle包

我照着你这样写只能加载一个业务包,加载第二个的时候就会报 Application has not been registered. 请问可能的问题有哪些

ReactNative call load bundle - iOS Crash

Error message
'Cannot invoke completion without jsMessageThread'

RN_App.js

const ocFunction = NativeModules.OCFunction;
loadBundle() {
    ocFunction.loadBizBundle(
      'index2.ios',
      'reactnative_multibundler2',
      (bundle, module) => {
        console.log(bundle + module);
      },
    );
  }

iOS_OCFunction.h

#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
NS_ASSUME_NONNULL_BEGIN

@interface OCFunction : NSObject<RCTBridgeModule>

@end

NS_ASSUME_NONNULL_END

iOS_OCFunction.m

#import "OCFunction.h"
@implementation OCFunction

RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(loadBizBundle:(NSString *)bundle moduleName:(NSString *)module findEvents:(RCTResponseSenderBlock)callback)
{
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    [[NSNotificationCenter defaultCenter]postNotificationName:@"loadBizBundle" object:@[bundle, module]];
    callback(@[bundle, module]);
  });
}

@end

iOS_AppDelegate.m

-(void)loadBundle:(NSNotification *)sender{
  if ([sender.object isKindOfClass:[NSArray class]]) {
    
    dispatch_async(dispatch_get_main_queue(), ^{
      NSString *bundle = (NSString *) [sender.object objectAtIndex:0];
      NSString *module = (NSString *) [sender.object objectAtIndex:1];
      NSURL *jsCodeLocationBuz = [[NSBundle mainBundle] URLForResource:bundle withExtension:@"bundle"];
      NSError *error = nil;
      NSData *sourceBuz = [NSData dataWithContentsOfFile:jsCodeLocationBuz.path options:NSDataReadingMappedIfSafe error:&error];
      [self->bridge.batchedBridge executeSourceCode:sourceBuz sync:NO];
      RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:self->bridge moduleName:module initialProperties:nil];
      UIViewController *controller = [UIViewController new];
      [controller setView:rootView];
      self.window.rootViewController = controller;
    });
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.