Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug JS Remotely #15805

Closed
sm2017 opened this issue Sep 5, 2017 · 6 comments
Closed

Debug JS Remotely #15805

sm2017 opened this issue Sep 5, 2017 · 6 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@sm2017
Copy link
Contributor

sm2017 commented Sep 5, 2017

Is this a bug report?

(Yes , 100000000%)

Have you read the Contributing Guidelines?

(Yes)

Environment

  1. react-native -v:
react-native-cli: 2.0.1
react-native: 0.47.1
  1. node -v:
v8.1.3
  1. npm -v:
5.0.3
  1. yarn --version:
0.27.5

Then, specify:

  • Target Platform: Android
  • Development Operating System: Windows10
  • Build tools: react-native run-android

Steps to Reproduce

You cannot easily reproduce error , this is a random cryptic error

Expected Behavior

Executing JS code must not depends on remote debug , So works well when remote debug is off or on

Actual Behavior

For android when remote debug is ON , code works and when OFF not works

Foe more information see:

https://medium.com/@jordan_mohi/cant-find-variable-symbol-in-react-native-782489d86bd7
#15786
#15497

Reproducible Demo

(N/A)

@iegik
Copy link

iegik commented Sep 5, 2017

I think, it's not a bug, it is a feature.
With Debug enabled, I think for debug needs are included some additional es6 modules, such as Request, Symbol or some of RegExp features, So, ensure, that You have all dependences included, before start to scripting.

For example,

npm install --save es6-symbol
import 'es6-symbol/implement';

In production mode, you would not need to have redundant script included.

Also, try the following configuration in gradle:

buildTypes {
        debug {
            shrinkResources true
            debuggable true
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "devsupport.pro"
            applicationIdSuffix ".debug"
        }
        release {
            shrinkResources true
            signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

@sm2017
Copy link
Contributor Author

sm2017 commented Sep 5, 2017

@iegik I think it is a bug because , I use Symbol in a js file from 6 months ago , I don't change this file from 2-3 months ago , suddenly react-native Can’t find variable: Symbol only on android when remote debug is not enabled (see #15786). If it is not a bug and a feature why iOS has not this feature?

If you think it is a feature , Why we lost BackHandler on android when remote debug is off? (See #15497)

@iegik
Copy link

iegik commented Sep 5, 2017

@sm2017 You can also try to debug with Android Monitor or logcat

@stale
Copy link

stale bot commented Nov 4, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 4, 2017
@stale stale bot closed this as completed Nov 11, 2017
@dummerbd
Copy link

Just fyi for people finding this issue via Google, the problem as I understand it is Symbol is not supported in the current version of the JavaScript Core shipped with Android but it is supported natively on iOS which has a newer version of JSC. The reason you don't see this issue when using Remote Debug is because your JavaScript actually runs remotely in Chrome which does support Symbol.

Long story short, use a polyfill for now like es6-symbol.

@joeytwiddle
Copy link

A possible polyfill solution is mentioned here

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants