2017-04-10 87 views

回答

0

生成你的包如前文所述,则:

为Android(在MainApplication.java)

public boolean getUseDeveloperSupport() { 
    return false; 
    //return BuildConfig.DEBUG; 
} 

对于iOS:(在AppDelegate.m)

//debugserver with fallback bundle 
// jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 
//always bundle 
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 

我想,如果你在生产模式realease也都自动改变......但我一直在使用这个,以确保它总是使用束。

-1

根据文档,你可以运行:

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/com/your-company-name/app-package-name/src/main/assets/index.android.bundle --assets-dest android/com/your-company-name/app-package-name/src/main/res/ 

来源:https://github.com/facebook/react-native/blob/master/docs/IntegrationWithExistingApps.md#creating-a-release-build-in-android-studio

+0

我知道如何为android做一个包,但我想知道如何让我的android应用程序从包中获取资源。谢谢 – RichardSleet