NativeScript / nativescript-fresco

This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.
Apache License 2.0
53 stars 23 forks source link

TypeError: Cannot read property 'base' of undefined #58

Closed bori87 closed 6 years ago

bori87 commented 6 years ago
System.err: File: "file:///data/data/com.domain.project/files/app/tns_modules/nativescript-fresco/nativescript-fresco.js, line: 92, column: 37
System.err:
System.err: StackTrace:
System.err:     Frame: function:'', file:'file:///data/data/com.domain.project/files/app/tns_modules/nativescript-fresco/nativescript-fresco.js', line: 92, column: 38
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/com.domain.project/files/app/tns_modules/nativescript-fresco/angular/nativescript-fresco.module.js', line: 6, column: 10
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/com.domain.project/files/app/tns_modules/nativescript-fresco/angular/index.js', line: 6, column: 10
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/com.domain.project/files/app/app.module.js', line: 13, column: 17
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:     Frame: function:'', file:'file:///data/data/com.domain.project/files/app/main.js', line: 5, column: 20
System.err:     Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: TypeError: Cannot read property 'base' of undefined
System.err: File: "<unknown>, line: 1, column: 265 ....

app.module.ts

import { TNSFrescoModule } from "nativescript-fresco/angular";
import application = require("application");
import fresco = require("nativescript-fresco");

if (application.android) {
    application.on("launch", () => {
        fresco.initialize();
    });
}

...

imports: [
    NativeScriptModule
    AppRoutingModule,
    TNSFrescoModule
  ],
"tns-android": {
      "version": "3.4.1"
   }
"dependencies": {
    "@angular/animations": "~5.0.0",
    "@angular/common": "~5.0.0",
    "@angular/compiler": "~5.0.0",
    "@angular/core": "~5.0.0",
    "@angular/forms": "~5.0.0",
    "@angular/http": "~5.0.0",
    "@angular/platform-browser": "~5.0.0",
    "@angular/platform-browser-dynamic": "~5.0.0",
    "@angular/router": "~5.0.0",
    "email-validator": "^1.1.1",
    "font-awesome": "^4.7.0",
    "nativescript-angular": "5.0.0",
    "nativescript-bitmap-factory": "^1.7.1",
    "nativescript-camera": "^3.2.1",
    "nativescript-fresco": "^3.0.6",
    "nativescript-google-maps-sdk": "^2.4.3",
    "nativescript-google-maps-utils": "^0.1.3",
    "nativescript-google-places": "0.0.3",
    "nativescript-imagepicker": "^4.0.1",
    "nativescript-plugin-firebase": "^5.1.4",
    "nativescript-pro-ui": "^3.3.0",
    "nativescript-theme-core": "1.0.4",
    "reflect-metadata": "0.1.10",
    "rxjs": "^5.5.0",
    "tns-core-modules": "^3.4.0",
    "tns-platform-declarations": "^3.4.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "lazy": "1.0.11",
    "nativescript-dev-sass": "^1.3.5",
    "nativescript-dev-typescript": "0.5.1",
    "typescript": "~2.4.2"
  }
VladimirAmiorkov commented 6 years ago

Hi @bori87 ,

Can you share with me more details about your project, it would be very useful to include:

From the stack trace it looks like the native object behind the AnimatedImage abstraction (the com.facebook.imagepipeline.animated.base.AnimatedDrawable) is not available in your app. This can be due to multiple versions of the native Android Fresco library in your {N} applications. In order to verify if there aren't multiple {N} plugins that use the native Android library by checking in platforms/android/app/build/configurations , in that folder you can find folders contains each plugin's include.gradle. Those files contains the name and version of the native library that is used by the specific plugin.

ghost commented 6 years ago

I've had the same issue with tns-android 3.4.1. For some reason NS didn't compile the java fresco lib by itself, I had to force it to make a clean/full build.

Delete platforms/android folder then run tns add platform android.

It's probably has more to do with NS itself than this library.

diego-lipinski-de-castro commented 6 years ago

Had same problem, solved with @mikolino answer.

VladimirAmiorkov commented 6 years ago

Closing this issue, resolution as mentioned by @mikolino here