I want to use cordova-plugin-firebase for phone verification.
I add the plugin as ionic doc, add google-service.json to my project, but when build for android it gives me the following error. I can build the project but when I call verifyPhoneNumber(phoneNumber, timeoutDuration) function, my app crash in my android device.
Preparing Firebase on Android
{ Error: ENOENT: no such file or directory, open ‘D:\node\ionic\smsVerification\platforms\android\res\values\strings.xml’
What is your ionic info
output?
Thanks Sujan from replay
My ionic info
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 25.2.5
Node : v8.9.4
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Program Files\Android\android-sdk
Misc:
backend : pro
I did these following from https://github.com/ionic-team/ionic/issues/13702
I don’t have much experience for dealing with java. I tried in below way…
Worked.
cordova platform remove android
cordova plugin remove cordova-plugin-firebase
next i added all back
cordova plugin add cordova-plugin-firebase@0.1.25 --variable APP_ID=“YOUR_APP_ID” --variable API_KEY=“YOUR_API_KEY” --save
Note: replace your original APP_ID and API_KEY in above command.
cordova platform add android
change below code in firbase ->after_prepare.js
after_prepare.js should be set to stringsXml: ANDROID_DIR +’/app/src/main/res/values/strings.xml’ on line
It solve the error but now it gives me Invalid phone number error
Cordova Android 7.0.0 changed the structure of the project.
Seems the Cordova Plugin you are trying to use was not updated to work with this new structure.
You should create a Github issue for that plugin (or see if this already exists).
1 Like