Google Login + FCM together in an Ionic 2 project - ionic-framework

I am using Ionic2 framework and my app requires Google Login and fcm to receive notifications.
I first integrated the Google Social Login using google plus native plugin and it was working perfectly fine. Then, on adding fcm I received following errors:
Found com.google.android.gms:play-services-location:11.+, but version 9.0.0 is needed for the google-services plugin.
Found com.google.android.gms:play-services-auth:11.8.0, but version 9.0.0 is needed for the google-services plugin.
Found com.google.android.gms:play-services-identity:11.8.0, but version 9.0.0 is needed for the google-services plugin.
:processArmv7DebugGoogleServices
FAILED
Because of the version conflict, I upgraded it to 9.0.0 and fcm is working fine now but the Google Login seems to have stopped working. I am receiving not even an error. The function leads to nothing.
Can anyone tell me a way to integrate Google Login + FCM together in an Ionic 2 project?

try to change this file under fcm plugin directory
/plugins/cordova-plugin-fcm/src/android/FCMPlugin.gradle
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.google.gms:google-services:3.0.0'
}
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
// apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
ext.postBuildExtras = {
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}
Then
ionic cordova platform rm android
ionic cordova platform add android
then change this file
/platforms/android/project.properties (removing + with 11.4.2)
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.+
cordova.system.library.2=com.google.firebase:firebase-core:11.4.2
cordova.system.library.3=com.google.firebase:firebase-messaging:11.4.2
cordova.gradle.include.1=cordova-plugin-fcm/mobile-FCMPlugin.gradle
cordova.system.library.4=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.5=com.google.android.gms:play-services-identity:11.4.2
cordova.system.library.6=com.android.support:support-v4:24.1.1+
cordova.gradle.include.2=cordova-support-google-services/mobile-build.gradle
cordova.gradle.include.3=twitter-connect-plugin/mobile-twitter.gradle
cordova.system.library.7=com.squareup.okhttp3:okhttp:3+
Then build
ionic cordova build android

Related

No podspec found for `package` when adding iOS project to existing Ionic 5 project

I built a Capacitor plugin for Ionic and Capacitor and published it to NPM - call it test1. I then use it in my Ionic 5 project and successfully add a new Android project via:
ionic build
ionic cap add android
ionic cap sync
Tested it and it works. I then try and add an iOS via:
ionic build
ionic cap add ios
I then get the following error:
`[!] No podspec found for `Test1` in `../../node_modules/test1```
And it fails. I can't figure out why as there is a Test1Plugin.podspec file in the root with relevant dependencies and an ios/Podfile with relevant dependencies. I also ensure both files are published to npm.
I tried changing the name of the .podspec file to Test1.podspec but it's the exact same issue.
I'm pretty stumped and hoping someone has some pointers as i've been on this for a while and tried everything.

Exception: Unsupported Android Plugin version: 4.1.2

I know this might have been asked before, I have recently installed Solus Linux on my computer and I am trying to get Andoird Studio working on it for some time, so far I am not having any luck.
First Issue - I am not able to add Flutter to the PATH
Second Issue - I am getting this error when running the project
Could somebody here help me with both issues?
Maybe it can help future devs. I had similar problem with the exception
Unsupported Android Plugin version 4.1.3
In my case I had to specify build flavor for the app:
flutter run --flavor <flavor-name>
then it worked
I think at the moment, there is a problem of incompatible version.
Reference: from this thread
To fix it, I revert back Android Plugin from 4.1.2 to 4.1.0.
Modify the root build.gradle:
buildscript {
ext.kotlin_version = '1.4.20'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
...
}
}
Note: I, currently, use Gradle 6.7
Doing this solved my problem
Added dev as Build flavor
Added --debug as Additional build args
In my case, I had to edit my configuration settings:
go to "Edit configurations"
choose the config you're trying to run
fill in the "Build flavor" accordingly
Worked for me
if your are performing integration test in flutter with flavors then you should run this command to test
flutter drive --flavor dev \ --driver=test_driver/integration_driver.dart \ --target=integration_test/login_page/login_integration_test.dart
For me, it was about the flavor configuration. I have main, develop, and production flavors I haven't set up configuration for main so when main is selected this error is happened
In my case, I solved it by changing the "splits" property to enable = false, in the build.gradle. When we release to production that property is set to true, so i just forgot to set it on false again.
Should be something like this:
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable false
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include 'arm64-v8a', 'armeabi-v7a'
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}

My login screen does not load when I start my flutter app

I don't know the gradle version and plugin to use with firebase authentication. The application runs fine when I load it through the debug mode and the login page shows up. But when I build the release apk the login page does not load up and the screen is blank. I had changed the gradle version from the default once before.
PLUGIN : distributionUrl = https://services.gradle.org/distributions/gradle-6.5.1-all.zip
GRADLE DIST: classpath 'com.android.tools.build:gradle:4.1.0'
Firebase auth version in pubspec : firebase_auth: ^0.18.4+1
this is what I am currently using
I don't think that gradle version is your problem. Basically, flutter's default version is more than fine for firebase packages.
EDIT:
That's my gradle version and firebase_auth is working for me:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
classpath 'com.android.tools.build:gradle:3.5.0'

after installing ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated my android built not working

Error: Execution failed for task ':processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.+.
i want ionic cordova plugin cordova-plugin-fcm-with-dependecy-updated for notification but build is crash after installed this plugin if i remove this plugin then my app is working
i try to use fcm plugin with android 8.0.0 with cordova-plugin-googleplus 7.0.0 and i try with android 7.4.1 and 6.4.0 with cordova-plugin-googleplus 5.2.1
try this!..
step 1 ionic cordova platform rm android
step 2 go to /plugins/cordova-plugin-fcm-with-dependecy-updated/src/android/FCMPlugin.gradle
change like this
buildscript {
repositories {
mavenCentral()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.google.gms:google-services:3.1.+'
}
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile 'com.google.firebase:firebase-core:11.4.2'
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
step 3 ionic cordova platform add android
step 4 Goto /platforms/android/project.properties
Change like the numbers into 11.4.2
cordova.system.library.3=com.google.firebase:firebase-core:11.4.2
cordova.system.library.4=com.google.firebase:firebase-messaging:11.4.2
cordova.system.library.7=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.4.2
demo project.properties file
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-badge/mobile-badge.gradle
cordova.system.library.2=com.facebook.android:facebook-android-sdk:4.25.0
cordova.system.library.3=com.google.firebase:firebase-core:11.4.2
cordova.system.library.4=com.google.firebase:firebase-messaging:11.4.2
cordova.gradle.include.2=cordova-plugin-fcm-with-dependecy-updated/mobile-FCMPlugin.gradle
cordova.system.library.6=com.android.support:appcompat-v7:25.+
cordova.system.library.7=com.google.android.gms:play-services-auth:11.4.2
cordova.system.library.8=com.google.android.gms:play-services-identity:11.4.2
cordova.gradle.include.3=cordova-plugin-local-notification/mobile-localnotification.gradle
cordova.gradle.include.4=cordova-plugin-telerik-imagepicker/mobile-ignorelinterrors.gradle
cordova.gradle.include.5=cordova-plugin-telerik-imagepicker/mobile-androidtarget.gradle
cordova.gradle.include.6=phonegap-plugin-barcodescanner/mobile-barcodescanner.gradle
cordova.system.library.11=com.android.support:support-v4:27.+
cordova.gradle.include.7=twitter-connect-plugin/mobile-twitter.gradle
cordova.system.library.12=com.squareup.okhttp3:okhttp:3.12.0
step 5 ionic cordova build android
Note :: Don't forgot to add google-services.json file in root directory, main_project/google-services.json
We have the same issue and yesterday we solve this problem with this answer:
Answer:1
This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so
cordova.system.library.4=com.google.firebase:firebase-core:16.0.8
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4
Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.
Now I can build successfully! I hope it helps!
Ref: page
Answer: 2
A wonderful person opened a pull request 31 in the cordova-firebase-plugin official repo and it works.
Steps I did:
1 - Remove cordova-firebase-plugin with ionic cordova plugin remove cordova-
firebase-plugin
2 - Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
3 - rm -rf node_modules/ plugins/ platforms/android package-lock.json
4 - ionic cordova platform add android && npm install
5 - In my case, I also use a firebase js library in an old version because the newest ones are not working for me. With that library I always need to reinstall it manually after all the previous steps, so also I did: npm install firebase#4.12.1.
And now it’s working.
ref: Page
I'm a Korean who develops with Cordova
I solved as below.
cordova-plugin-admob-free and
Library conflict with cordova-plugin-fcm-with-dependecy-updated.
I changed only the ads version and ran it as shown below.
I am not sure if the content will be delivered using Google Translate.
enter image description here
/platforms/android/project.properties
cordova.system.library.1=com.google.firebase:firebase-core:16.0.9
cordova.system.library.2=com.google.firebase:firebase-messaging:18.0.0
cordova.gradle.include.1=cordova-plugin-fcm-with-dependecy-updated/helloworld-FCMPlugin.gradle
cordova.system.library.3=com.google.android.gms:play-services-base:11.0.4
cordova.system.library.4=com.google.android.gms:play-services-ads:17.0.0

Modify cordova plugin - app not see changes

I need to modify cordova-plugin-media, but when I run app with ionic cordova run android my changes are not applied.
How should I modify and run plugin correctly?
I found the answer.
cordova files should be edited in /plugins folder, not in /node_modules
after editing, I should do: ionic cordova platform rm android and ionic cordova build android
After that modifications work.
You should paste some code, showing the code of app module and config.xml.
But basically you should only do:
ionic cordova plugin add cordova-plugin-media
npm install --save #ionic-native/media
And then add your plugin to the project into file
App.module.ts:
import { Media } from '#ionic-native/media';
...
providers: [
....
Media,
...
]
And that's it, then you should be able to use the functionalities inside your components.