TypeError using FingerPrint aio

I am trying to implement the authentication of my Ionic v4 application through the fingerprint-aio plugin.

However, when trying to use, the error below occurs (I’m running the application on the smartphone (android):

TypeError: Object(…) is not a function

I did the installation according to the official documentation of the Ionic Framework: https://ionicframework.com/docs/native/fingerprint-aio

ionic cordova plugin add cordova-plugin-fingerprint-aio
npm install @ionic-native/fingerprint-aio

Includes the reference in the app.module.ts

import { FingerprintAIO } from ‘@ionic-native/fingerprint-aio/ngx’;

@NgModule({

declarations: [MyApp],

imports: [
BrowserModule,
SharedModule,
AutenticacaoModule,
AdministracaoModule,
ContaCorrenteModule,
CoreModule,
CorporativoModule,
EmprestimoModule,
InicioPageModule,
InvestimentoModule,
LoginPageModule,
TransferenciaModule,
AprovacaoModule,
ComprovanteModule,
HttpModule,
CacheModule.forRoot(),
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot()

],

bootstrap: [IonicApp],
entryComponents: [MyApp],

providers: [
StatusBar,
SplashScreen,
{ provide: ErrorHandler, useClass: IonicErrorHandler },
{ provide: LOCALE_ID, useValue: ‘pt-BR’ },
UtilitarioProvider,
File,
FileTransfer,
FileOpener,
AppVersion,
GerenciarTokenService,
Device,
BarcodeScanner,
SocialSharing,
Screenshot,
InAppBrowser,
FingerprintAIO
]

})

export class AppModule {}

home.ts

.
.
.
import { FingerprintAIO } from ‘@ionic-native/fingerprint-aio/ngx’;

@IonicPage()

@Component({
selector: ‘home-login’,
templateUrl: ‘home.html’
})

export class HomePage {

constructor(
private navCtrl: NavController,
private autenticacaoService: AutenticacaoService,
private toastCtrl: ToastController,
private loadingCtrl: LoadingController,
private usuarioService: UsuarioService,
private warmupSerice: WarmupService,
private menu: MenuController,
private utilService: UtilService,
public platform: Platform,
private appVersion: AppVersion,
private gerenciarToken: GerenciarTokenService,
private iab: InAppBrowser,
private faio: FingerprintAIO
) {

if (this.platform.is('cordova')) {
  this.platform.ready().then(() => {
    this.appVersion.getVersionNumber().then(ver => (this.versao = ver));
  });
}

this.menu.swipeEnable(false);

}

biometric() {
try {
this.faio.show({
title: ‘Biometric Authentication’, // (Android Only) | optional | Default: “<APP_NAME> Biometric Sign On”
subtitle: ‘Coolest Plugin ever’, // (Android Only) | optional | Default: null
description: ‘Please authenticate’, // optional | Default: null
fallbackButtonTitle: ‘Use Backup’, // optional | When disableBackup is false defaults to “Use Pin”.
// When disableBackup is true defaults to “Cancel”
disableBackup:true, // optional | default: false
})
.then((result: any) => alert(result))
.catch((error: any) => alert(error));
} catch (e) {
alert('catch ’ + e);
}

}

}

I’m using android 9.0.0

ionic cordova platform add android@9.0.0

My Ionic Info

Ionic:
ionic (Ionic CLI) : 4.11.0 (C:\Users\camilaba\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.4

Cordova:
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 14 other plugins)

System:
Android SDK Tools : 26.1.1 (C:\Users\camilaba\AppData\Local\Android\Sdk)
NodeJS : v14.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.11
OS : Windows 10

Please post the dependencies section of your package.json. I suspect you may be mixing parts of Ionic Native that have different major versions.

Hi, Follows the package.json dependencies:

“dependencies”: {
@angular/animations”: “5.2.9”,
@angular/common”: “^5.2.9”,
@angular/compiler”: “5.2.9”,
@angular/compiler-cli”: “5.2.9”,
@angular/core”: “5.2.9”,
@angular/forms”: “5.2.9”,
@angular/http”: “5.2.9”,
@angular/platform-browser”: “5.2.9”,
@angular/platform-browser-dynamic”: “5.2.9”,
@ionic-native/android-permissions”: “^4.20.0”,
@ionic-native/app-version”: “^4.20.0”,
@ionic-native/barcode-scanner”: “^4.20.0”,
@ionic-native/core”: “^4.11.0”,
@ionic-native/device”: “^4.20.0”,
@ionic-native/file”: “^4.12.2”,
@ionic-native/file-opener”: “^4.12.2”,
@ionic-native/file-transfer”: “^4.12.2”,
@ionic-native/fingerprint-aio”: “^5.32.0”,
@ionic-native/in-app-browser”: “^4.20.0”,
@ionic-native/screenshot”: “^4.20.0”,
@ionic-native/social-sharing”: “^4.20.0”,
@ionic-native/splash-screen”: “4.6.0”,
@ionic-native/status-bar”: “^4.6.0”,
@ionic/angular”: “^4.11.7”,
@ionic/storage”: “2.1.3”,
@types/cordova”: “0.0.34”,
@types/cryptojs”: “^3.1.29”,
“angular-svg-round-progressbar”: “^3.0.1”,
“br-mask”: “0.0.8”,
“brmasker-ionic-3”: “^1.6.3”,
“codelyzer”: “^4.4.4”,
“com.darktalker.cordova.screenshot”: “0.1.6”,
“cordova-android”: “9.0.0”,
“cordova-browser”: “5.0.4”,
“cordova-ios”: “4.5.5”,
“cordova-lib”: “^8.1.1”,
“cordova-plugin-androidx-adapter”: “^1.1.3”,
“cordova-plugin-app-version”: “^0.1.9”,
“cordova-plugin-device”: “^2.0.3”,
“cordova-plugin-file”: “^6.0.2”,
“cordova-plugin-file-opener2”: “^2.2.1”,
“cordova-plugin-file-transfer”: “^1.7.1”,
“cordova-plugin-fingerprint-aio”: “^4.0.2”,
“cordova-plugin-inappbrowser”: “3.2.0”,
“cordova-plugin-ionic-keyboard”: “^2.2.0”,
“cordova-plugin-ionic-webview”: “^4.1.3”,
“cordova-plugin-ios-camera-permissions”: “1.2.0”,
“cordova-plugin-splashscreen”: “^5.0.3”,
“cordova-plugin-statusbar”: “^2.4.3”,
“cordova-plugin-unique-device-id2”: “^2.0.0”,
“cordova-plugin-whitelist”: “^1.3.4”,
“cordova-plugin-wkwebview-engine”: “^1.2.1”,
“cordova-plugin-x-socialsharing”: “5.6.3”,
“crypto-js”: “^3.1.9-1”,
“es6-promise-plugin”: “^4.2.2”,
“har-validator”: “^5.1.3”,
“ionic-angular”: “3.9.2”,
“ionic-cache”: “^3.0.1”,
“ionicng2-currency-mask”: “^2.0.7”,
“ionicons”: “3.0.0”,
“lakmus”: “^0.3.0”,
“lodash”: “^4.17.15”,
“moment”: “^2.22.0”,
“ng-circle-progress”: “^1.0.0”,
“ng2-nvd3”: “^2.0.0”,
“node-sass”: “^4.10.0”,
“phonegap-plugin-barcodescanner”: “github:moraisandre/phonegap-plugin-barcodescanner#master”,
“rxjs”: “^5.5.11”,
“sw-toolbox”: “3.6.0”,
“tsutils”: “^3.5.2”,
“zone.js”: “0.8.20”
},
“devDependencies”: {
@ionic/app-scripts”: “^3.2.4”,
@ionic/lab”: “2.0.13”,
“tslint-ionic-rules”: “0.0.19”,
“typescript”: “^2.9.2”
},

Exactly as I suspected. You’re mixing ionic-native 4 and 5 pieces - they must all be on the same major version.

1 Like

How do I make the versions the same? I’m sorry for the question, I’m new to ionic.

I tend to just edit package.json directly, but you can do it all using npm as well.

1 Like

Thank you soo much. It’s works.

i’m resolve this change package.json.

@ionic-native/app-version”: “^4.20.0”,
@ionic-native/barcode-scanner”: “^4.20.0”,
@ionic-native/core”: “^4.11.0”,
@ionic-native/device”: “^4.20.0”,
@ionic-native/file”: “^4.12.2”,
@ionic-native/file-opener”: “^4.12.2”,
@ionic-native/file-transfer”: “^4.12.2”,
@ionic-native/fingerprint-aio”: “^4.20.0”,
@ionic-native/in-app-browser”: “^4.20.0”,
@ionic-native/screenshot”: “^4.20.0”,
@ionic-native/social-sharing”: “^4.20.0”,
@ionic-native/splash-screen”: “4.6.0”,
@ionic-native/status-bar”: “^4.6.0”,

but, i’m change import too, like this:

import { FingerprintAIO } from '@ionic-native/fingerprint-aio';