tradingview / charting-library-tutorial

This tutorial explains step by step how to connect your data to the Charting Library
MIT License
397 stars 306 forks source link

Android tutorial - tvWidget is not defined #76

Open Sotatek-HieuVu opened 1 year ago

Sotatek-HieuVu commented 1 year ago

Is there any tutorial about how to implement this one in Android or iOS (or both)? I tried to combine the charting-library-example and this tutorial, but it completely did not work. I keep receiving errors:

I/chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Cannot use import statement outside a module", source: file:///android_asset/charting_library/src/datafeed.js (1)
I/chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Cannot use import statement outside a module", source: file:///android_asset/charting_library/src/main.js (1)
I/chromium: [INFO:CONSOLE(2)] "Uncaught ReferenceError: tvWidget is not defined", source: file:///android_asset/charting_library/index.html (2)

Here is how I did it:

  1. Clone an example of Android in charting-library-example
  2. Add folder charting_library into the source code that I just cloned
  3. Add folder src of this tutorial into the source code
  4. Copy the content of a file index of this tutorial and replace it into file index.js in the source code
  5. Run the source code (in both the emulator and real device)

Here is what my source code looks like after I finish all steps: image