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

Android Emulator: SyntaxErorr ' Attempt to redefine Property 'Content - Type' #12592

Closed
nicolabortignon opened this issue Feb 26, 2017 · 4 comments · May be fixed by hixio-mh/react-native#19
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@nicolabortignon
Copy link

Description

screen shot 2017-02-26 at 12 08 03 pm

Unfortunately I have no idea where to start to fix this.
If I select Remote JS Debugging, the error disappear and the app starts and works normally.
I don't have this problem while running on iOS

Reproduction

This happens when I try to run react-native run-android on this repo

Solution

Additional Information

  • React Native version:
    react-native-cli: 2.0.1
    react-native: 0.40.0
  • Platform:
    android 23.0.1
  • Operating System:
    OSX Sierra
@ericvicenti
Copy link
Contributor

Hmm, all I can suggest here is process of elimination. Does this happen when you debug a blank project in your environment? Does this happen just on emulator or also on device? Have you tried both genymotion and android emulator?

@nicolabortignon
Copy link
Author

This is the log from logcat, quite not informative, anything else I can do?

02-27 12:31:10.666  1531  1895 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@c3700b7 attribute=null, token = android.os.BinderProxy@acf71f4
02-27 12:31:10.669  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
02-27 12:31:10.670  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
02-27 12:31:10.672  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
02-27 12:31:10.678  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
02-27 12:31:10.679  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
02-27 12:31:10.679  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
02-27 12:31:10.680  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
02-27 12:31:10.680  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
02-27 12:31:10.681  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
02-27 12:31:10.682  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
02-27 12:31:10.683  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
02-27 12:31:10.684  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
02-27 12:31:10.685  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
02-27 12:31:10.685  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
02-27 12:31:10.686  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
02-27 12:31:10.688  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
02-27 12:31:10.693  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
02-27 12:31:10.696  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
02-27 12:31:10.702  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
02-27 12:31:10.703  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
02-27 12:31:10.707  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
02-27 12:31:10.716  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
02-27 12:31:10.717  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
02-27 12:31:10.719  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
02-27 12:31:10.720  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.recyclerview.RecyclerViewBackedScrollViewManager
02-27 12:31:10.722  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
02-27 12:31:10.728  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLikeViewManager
02-27 12:31:10.729  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLoginButtonManager
02-27 12:31:10.730  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBSendButtonManager
02-27 12:31:10.730  2599  2617 W art     : Before Android 4.1, method boolean com.facebook.share.widget.ShareButtonBase.canShare() would have incorrectly overridden the package-private method in android.widget.TextView
02-27 12:31:10.731  2599  2617 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBShareButtonManager
02-27 12:31:10.780  2599  2599 W unknown:React: Packager connection already open, nooping.
02-27 12:31:10.780  2599  2599 W unknown:React: Inspector connection already open, nooping.
02-27 12:31:10.812  1531  1550 W AppOps  : Finishing op nesting under-run: uid 10055 pkg com.rnfashion code 24 time=0 duration=0 nesting=0
02-27 12:31:10.873  2599  2639 E unknown:React: Exception in native call from JS
02-27 12:31:10.873  2599  2639 E unknown:React: com.facebook.react.devsupport.JSException: SyntaxError: Attempted to redefine property 'Content-Type'. (http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70987)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at android.os.Handler.handleCallback(Handler.java:739)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at android.os.Handler.dispatchMessage(Handler.java:95)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at android.os.Looper.loop(Looper.java:148)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
02-27 12:31:10.873  2599  2639 E unknown:React: 	at java.lang.Thread.run(Thread.java:818)
02-27 12:31:10.873  2599  2639 E unknown:React: Caused by: com.facebook.jni.CppException: SyntaxError: Attempted to redefine property 'Content-Type'. (http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:70987)
02-27 12:31:10.873  2599  2639 E unknown:React: 	... 7 more
02-27 12:31:10.881  2599  2639 E unknown:React: Exception in native call
02-27 12:31:10.881  2599  2639 E unknown:React: java.lang.RuntimeException: Error calling function: RCTDeviceEventEmitter:emit
02-27 12:31:10.881  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
02-27 12:31:10.881  2599  2639 E unknown:React: 	at android.os.Handler.handleCallback(Handler.java:739)
02-27 12:31:10.881  2599  2639 E unknown:React: 	at android.os.Handler.dispatchMessage(Handler.java:95)
02-27 12:31:10.881  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
02-27 12:31:10.881  2599  2639 E unknown:React: 	at android.os.Looper.loop(Looper.java:148)
02-27 12:31:10.881  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
02-27 12:31:10.881  2599  2639 E unknown:React: 	at java.lang.Thread.run(Thread.java:818)
02-27 12:31:10.881  2599  2639 E unknown:React: Caused by: java.lang.RuntimeException: Empty Optional cannot be unwrapped
02-27 12:31:10.881  2599  2639 E unknown:React: 	... 7 more
02-27 12:31:10.886  2599  2639 E unknown:React: Exception in native call
02-27 12:31:10.886  2599  2639 E unknown:React: java.lang.RuntimeException: Error calling function: AppRegistry:runApplication
02-27 12:31:10.886  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
02-27 12:31:10.886  2599  2639 E unknown:React: 	at android.os.Handler.handleCallback(Handler.java:739)
02-27 12:31:10.886  2599  2639 E unknown:React: 	at android.os.Handler.dispatchMessage(Handler.java:95)
02-27 12:31:10.886  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
02-27 12:31:10.886  2599  2639 E unknown:React: 	at android.os.Looper.loop(Looper.java:148)
02-27 12:31:10.886  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
02-27 12:31:10.886  2599  2639 E unknown:React: 	at java.lang.Thread.run(Thread.java:818)
02-27 12:31:10.886  2599  2639 E unknown:React: Caused by: java.lang.RuntimeException: Empty Optional cannot be unwrapped
02-27 12:31:10.886  2599  2639 E unknown:React: 	... 7 more
02-27 12:31:10.889  2599  2639 E unknown:React: Exception in native call
02-27 12:31:10.889  2599  2639 E unknown:React: java.lang.RuntimeException: Error calling function: RCTDeviceEventEmitter:emit
02-27 12:31:10.889  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
02-27 12:31:10.889  2599  2639 E unknown:React: 	at android.os.Handler.handleCallback(Handler.java:739)
02-27 12:31:10.889  2599  2639 E unknown:React: 	at android.os.Handler.dispatchMessage(Handler.java:95)
02-27 12:31:10.889  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
02-27 12:31:10.889  2599  2639 E unknown:React: 	at android.os.Looper.loop(Looper.java:148)
02-27 12:31:10.889  2599  2639 E unknown:React: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
02-27 12:31:10.889  2599  2639 E unknown:React: 	at java.lang.Thread.run(Thread.java:818)
02-27 12:31:10.889  2599  2639 E unknown:React: Caused by: java.lang.RuntimeException: Empty Optional cannot be unwrapped
02-27 12:31:10.889  2599  2639 E unknown:React: 	... 7 more

@haloJim
Copy link

haloJim commented Mar 9, 2017

I have the same issue as you. After checking, this problem does not happen in the ES6 in android because it's supported to redefine in ES6. Check your code (even node_module code) by opening your bundle file and check the corresponding 70915 lines of code to find which 'Content - Type' is redefine.

@nicolabortignon
Copy link
Author

That solve the problem, thank you @haloJim

for those having the same error, what i did is:
on the machine when the package is running, head to
http://127.0.0.1:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false

check the line, most probably you are trying to redefine something that you already did before.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants