I have properly working in development environment react-native application. I wanted to test it's performance and released a build, which crashes after the launch.
01-09 20:16:13.644 23215 23251 E ReactNativeJS: Object type 't' not found in schema.
01-09 20:16:13.648 23215 23251 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
I couldn't determine the cause of crashing because of minification and uglify of the sources. Could you, please, help me with disabling it, because I already spent plenty of hours on it.
react-native version: 0.49.5
putting --minify=false in extraPackagerArgs in android/app/build.gradle should do the job.
project.ext.react = [
entryFile: "index.js",
extraPackagerArgs: [ '--minify=false' ],
];
You can accomplish this with the use of the CLI tool, Haul
Haul bundle --minify false should do the trick, if not, Haul provides other commands as well.
I think you should first test your app by unchecking dev mode on your in app developer menu.
i had the same problem and it took me some time to figure out.
i disabled the dev mode so it generates the JS bundle same like release bundle and i found the problem and fixed it.
If anyone got to here this might help:
node_modules/.bin/haul bundle --dev=false --config=node_modules/react-native-bundle-visualizer/src/webpack.haul.js
you can know more doing:
node_modules/.bin/haul bundle --help
Related
After new installation by running command
react-native init AwesomeProject
The command "react-native run-android" display lot of "babel:config:config-chain" messages and the app not run ...
babel:config:config-chain Ignored '/home/argaz/AwesomeProject/node_modules/metro/src/JSTransformer/worker.js' because it failed to match one of [ /^\/home\/argaz\/AwesomeProject\/node_modules\/react-native\/local-cli/,
babel:config:config-chain /^\/home\/argaz\/AwesomeProject\/node_modules\/react-native\/local-cli/ ] from '/home/argaz/AwesomeProject' +125ms
babel:config:config-chain Ignored '/home/argaz/AwesomeProject/node_modules/metro/src/ModuleGraph/worker/JsFileWrapping.js' because it failed to match one of [ /^\/home\/argaz\/AwesomeProject\/node_modules\/react-native\/local-cli/,
More informations :
react v16.6.3
react-native v0.57.8
node v10.1.2
Anyone encounter this problem ?
Thanks
Babel logs that output when the DEBUG environment variable is set to something like *, or something more specific like babel:*, babel:config:* or babel:config:config-chain. Something in your build system must be setting that variable.
How do I get rid of console logs from an ionic 2 release application?
I am developing an ionic 2 app. When I build the release apk and run on a device, I can still attach to the process from chrome://inspect, and view console logs. I have tried removing the cordova-plugin-console, but that makes no difference.
Edit: I found a package that can remove console logs: https://www.npmjs.com/package/remove-console-logs
Just not sure how I can use it to automatically remove them when I build release. Please help.
Thanks.
You can use uglifyjs.config.js for drop all console logs when is a production build.
1 . Copy uglifyjs.config.js from node_modules into your project folder
2 . In the new config file set the flag drop_console to true if production
var isProduction = process.env.IONIC_ENV === 'prod';
...
compress: {
drop_console: isProduction
}
3 . Set your custom configuration in the package.json
"config": { "ionic_uglifyjs": "uglifyjs.config.js" },
And that's all !
If you can still connect with the debugger then it is not a release build - sounds like you may be unintentionally installing the debug build OR connecting to some other app.
EDIT; Above is not necessarily true - there are instances where you can debug the js/html/css content via chrome in a release build ; specifically if the webview debuggability flag is set in code / not set by the build system etc. - this flag is seperate from the application debug flags so if not properly set you will be able to debug a "release" build / not be able to debug a "debug" build - see remote debugging webviews.
END OF EDIT.
( note you have to sign a release build before it will install )
Is it possible the release install failed and you're still looking at a previous debug build ?
Assuming you have a release build and can't connect to see logs via chrome inspect then ;
console.log calls will still be in the release build unless you comment them out - and possibly visible in other ways eg. android tools sdk\tools\monitor - The only way to be sure they aren't visible is to comment them out. You could use something like ;
console.log = function(){} ;
at the end of your device ready function after any plugins have done anything they're likely to do - though there's still no 100% guarantee with this as a badly behaving 3rd party plugin or library might reassign it later and then your calls will still happen - to be absolutely sure you will need to comment them out.
Have you tried remove console logs ?
cordova plugin rm cordova-plugin-console
Then
cordova build --release android
I'm working on this app project where I need to schedule notifications based on a list of predefined texts. Everything works fine on my dev environment, but when I build the APK release, they won't work. Debugging further I found out the notifications are a NativeModule and it becomes undefined on the release.
This returns the module attributes on react-native run-android but undefined in the release:
console.log(React.NativeModules.NotificationModule);
This is the actual error that led me to it:
Notification
.create({ attrs })
.then((n) => console.log('Notification', n)
.catch((err) => console.log(err);
Prints:
{ [TypeError: undefined is not an object (evaluating 'd.rGetApplicationName')] line: 670 column: 2663, sourceURL: 'index.android.bundle' }
I'm using react-native-system-notification with what I understand is an unrelated modification that removes the GCM requirement.
There's this issue but the project seems inactive since August and the issue is from April.
So, where else should I look for to solve this?
I dug into their source--it looks good. Almost feels like a configuration error on your end. Go through their installation steps really carefully, and in the output of ./gradlew assembleRelease, make sure you see it compiled/linked in the output. Also, make sure your React Native version is up-to-date.
I've disabled proguard from the release and the notifications started to work! No idea how to prevent proguard from messing with the package, but it was only saving 1Mb so I'm happy with this solution.
def enableProguardInReleaseBuilds = false
in android/app/build.gradle
I have a React Native project and it runs successfully on both simulators and devices for iOS.
However, for Android, it runs successfully on simulators without any problems, but when run on devices as a Release build, it gives me this error:
Requiring unknown module "react-native-safari-view".
I tried npm cache clean and npm install several times, but it does not work.
The module exists in node_modules folder and it is also under dependencies in package.json.
What could be the cause of this? Why does it happen only in Release builds?
Update: If this is difficult to fix, is it possible to generate a signed apk with the js bundle included in dev mode?
It is because react-native-safari-view module is not designed for Android.
Check this out: (inside index.android.js file in GitHub)
var SafariViewManager = {
test: function() {
warning('Not yet implemented for Android.');
},
isAvailable: function() {
...
}
};
Maybe you are initiating a SafariViewManager object and calling other functions like show() in index.ios.js without checking it isAvailable()?
I'm trying to run my react native android app in debug mode on our devices, without the need for a dev server running on a dev box. I'm using the debug variant/scheme on both platforms to facilitate the "staging" version of our app, since I've read that react native is not super friendly with build modes other than release and debug.
On the iOS side, I was able to modify the AppDelegate.m as follows... basically, if it's a debug build and it was built by buddybuild, don't look for a dev machine for the js bundle, look to the device:
#ifdef DEBUG
NSDictionary *infoPlistDict = [[NSBundle mainBundle] infoDictionary];
if (infoPlistDict[#"BUDDYBUILD_BUILD_ID"]) {
// deployed via buddybuild, don't use localhost
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
} else {
jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
}
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
#endif
... I'm looking for a way to do this on android. I have the buddybuild bit of code I need, so no worries there, I just want to know how to programmatically change the location of the js bundle on android as I do above for iOS in AppDelegate.m. Right now, all code related to the location of the js bundle on android seems to be in the react-native package itself and I'd rather not hack that to get it to work.
If I can provide any more information, please let me know.
I would like to summarize the solution to bundle everything within a debug build. Especially the hint in point two did the trick for me. Thanks #Tspoon.
1. Android Studio
go to Preferences -> Build, Execution, Deployment -> Compiler
uncheck "Configure on Demand"
2. build.gradle
within your app/build.gradle file do the following:
project.ext.react = [
// whether to bundle JS and assets in debug mode
bundleInDebug: true,
// whether to bundle JS and assets in release mode
bundleInRelease: true,
]
apply from: "../../node_modules/react-native/react.gradle"
NOTE that it is important to define the react settings above the apply from ... statement, otherwise it will not work
3. Create APK
create your dev apk as usual with ./gradlew assembleDebug within your android folder
On Android, you'll want to modify android/app/build.gradle.
Before the apply from: "../../node_modules/react-native/react.gradle" line, you'll want to tell the packager to bundle the js assets and include them when deploying your APK.
For example:
project.ext.react = [
bundleInBuddybuild: true,
]
Where the syntax is bundleIn${productFlavor}${buildType}
Or if you just want to do it for for debug builds:
project.ext.react = [
bundleInDebug: true,
]