I am trying to work on react native for android application development. I am using android studio for that, but I am unable to debug the .js files developed for react native. Whenever there is any problem with code its giving me error, Unexpected Token, I am unable to know that how to debug or get proper error. Is there any framework available to work on React native for Android app development. I have already figured out a lot but unable to get any solution to debug android app based on React Native.
You can debug JavaScript code, console.log etc in Chrome. You have to select "Debug in Chrome" from the developer menu on device first and that will open a new tab on Chrome at localhost:8081/debugger-ui. However, to debug in Chrome, keep in mind you have to install React Developer Tools on Chrome https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
You need to debug in Chrome. There are good docs on the RN site about debugging:
https://facebook.github.io/react-native/docs/debugging.html#content
However, if you have syntax errors the debugger won't help you, but Chrome Dev tools might give you a better idea of where the error is.
Related
I'm new to sentry. I have a react native mobile application from react native version 0.59. I have set up sentry for the mobile app as per this guide.
https://docs.sentry.io/platforms/react-native/
When I ran the react native bundle command and try to create an android build using android studio following error comes. I searched in google and couldn't find a proper answer for my question. Does anyone know how to fix this issue.
did you execute the sentry-wizard command and did it work? if yes, then please, export the system env. SENTRY_LOG_LEVEL as mentioned in the error message and paste us the full log so we could have a look into it.
I am using Telerik AppBuilder trial version(3.5.1) for the mobile app using NativeScript. I am getting only "Build" and "Build and Deploy" options. But I am unable to debug our app.
I am beginner in NativeScript, even I don't know, how to put break point for debug. Please help. I will be highly obliged.
Is there a way to debug native java code for Android app built using react-native. Specifically, I want to debug a third party Android package that I am using in my react-native app. There are may blog posts and stackoverflow questions on how to debug the js code but I didn't find any post describing how to debug native java code. I tried to just import the third party Android package into Android Studio and tried to run it in debugger but nothing really happened which I kind of expected.
Please let me know if and how it can be achieved. Thanks!
You can open the project in Android Studio and debug any native code there (add breakpoints, debug step by step, etc).
Be sure to launch the React Native packager beforehand. And then launch your app from Android Studio in debug mode.
More info: https://developer.android.com/studio/debug/index.html
Launch the React Native packager by running 'react-native start' in the root directory of your React Native Project.
Open the "android" directory of your React Native project in Android Studio.
Then you will be able run and debug your React Native application from Android Studio.
The way I could debug java code is the following:
shell: npm run android
Android Studio: "Attach debugger to Android Process" ->
Voila!
I have an android app built via Ionic Framework. The issue is it is working fine in the browser but not working as expected in the android app, which I installed on my phone. The issue is that I am not able to navigate the app on my phone.After connecting to chrome dev tools, seeing the link in the dev tools I found out that there is a difference. The link in dev tools is
file:///android_asset/www/index.html#/sideMenu/dashboard/dashboard/month
and link in my browser is
http://localhost:8100/#/sideMenu/dashboard/dashboard/month
could this be the reason? Most of you would be doing the same thing. So how do you guys resolve it?
EDIT
Screen shot of chrome inspect
There were errors in my app generating from the fact that It was not able to access the internet. Download the Cordova's whitelisting plugin. It should do the trick and it's a known issue that if you have even a single error in your app. It could possibly break the flow.
There's an option in the Android project settings in the Android Options section on the Packaging tab that lets you choose between the Xamarin debugger or the Microsoft debugger. The Xamarin debugger works, but not as good as the Microsoft one might. Unfortunately I get an error message when trying to use the Microsoft debugger and deploy on one of the Visual Studio Android Emulators.
Unable to start debugging. Non-debuggable application installed on the target device. Required file '/data/data/My.Application/lib/gdbserver' could not be found on the device. Please install a debuggable version.
Is there any way to get the Microsoft debugger to work?
The Xamarin debugger can only debug managed (i.e. C#) code. Breakpoints only work with the Xamarin debugger if the project being debugged is a managed project. They don't work if the project is a native app or native library.
The Microsoft debugger can only debug native (i.e. C/C++) code. Breakpoints only work with the Microsoft debugger if the project being debugged is a native app or native library, or if it is attached to an already-running Android process.
To get gdbserver into the app package, you either have to reference a native code library from your managed app, or include it (with build action set to AndroidNativeLibrary). I found you can also add a link to gdbserver (again, with build action set to AndroidNativeLibrary) from a project and make use of path sniffing to select the gdbserver from the matching ABI. Snippet of project file:
<ItemGroup>
<AndroidNativeLibrary Include="$(ANDROID_NDK_ROOT)\prebuilt\android-arm\gdbserver\gdbserver">
<Link>lib\armeabi-v7a\gdbserver</Link>
</AndroidNativeLibrary>
</ItemGroup>
Also please see my answer to a similar question.