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

Angular7 Android doesn't work #42

Open
mosilver opened this issue Mar 13, 2019 · 1 comment
Open

Angular7 Android doesn't work #42

mosilver opened this issue Mar 13, 2019 · 1 comment

Comments

@mosilver
Copy link

mosilver commented Mar 13, 2019

Is that plugin compactible with newest angular (7) and nativeScript (5) ?

I have created a new angular template project with nativescript CLI, added this plugin and I can't force it work, in general I have problem with path to file source, but using the same path for png file it's fine

By default with angular shared code project we should put all resources in src/assets

<StackLayout class="page">
   <SVGImage src="~/assets/images/nativescript.svg" height="100" width="100"></SVGImage>
</StackLayout>

JS: ERROR Error: java.io.FileNotFoundException: /data/data/org.nativescript.nowy/files/app/assets/images/nativescript.svg (No such file or directory)

I tried as well images folder in root of src, in app folder and so on... :

<StackLayout class="page">
   <SVGImage src="~/images/nativescript.svg" height="100" width="100"></SVGImage>
</StackLayout>

JS: ERROR Error: java.io.FileNotFoundException: /data/data/org.nativescript.nowy/files/app/images/nativescript.svg (No such file or directory)

I tried to use platform resources folder:

<StackLayout class="page">
    <SVGImage src="res://nativescript.svg" height="100" width="100"></SVGImage>
</StackLayout>

then no error but no image as well, even in official githab version with angular 4

When trying to load external resources:

<StackLayout class="page">
    <SVGImage src="https://svgshare.com/i/BjR.svg" height="100" width="100"></SVGImage>
</StackLayout>

JS: ERROR Error: Cannot convert object to Ljava/lang/String; at index 0

@ihor-lev
Copy link

@mosilver: It helped for me to include svg files in webpack.config.js as assets which should be copied to out dir. Here it is:

      // Copy assets to out dir. Add your own globs as needed.
      new CopyWebpackPlugin([
        {from: "fonts/**"},
        {from: "**/*.jpg"},
        {from: "**/*.png"},
        {from: "**/*.svg"},
      ], {ignore: [`${relative(appPath, appResourcesFullPath)}/**`]}),

But I have started using the fork https://github.com/TeamHive/nativescript-svg which is installed as tns plugin add "@teammaestro/nativescript-svg". This fork is using more fresh SVG library for android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants