Push plugin - Found item String/google_app_id more than one time - ionic-framework

I'm using Ionic2 and I just installed Push plugin into the App, and now its createing a duplicate of #string/google_app_id
Even if i delete one of them, when i run the project, ionic creates another one and I can't compile the app due to this error.
So this is what i get in the strings.xml
<string name="google_app_id">#string/google_app_id</string>
<string name="google_app_id" translatable="false">XXXXXXXXXX</string>
I tried removing the platform and the plugin and add it again to the proyect, but the error keeps showing.
Thank you all!!

You can see here that the firebase plugin does not handle the app id and api key.
In your case you can do this after installing the firebase plugin. Go to plugins folder and open cordova-plugin-firebase\plugin.xml and remove these lines,
<config-file parent="/resources" target="res/values/strings.xml">
<string name="google_app_id">#string/google_app_id</string>
</config-file>
Then add the android platform. Now you can build/run your android app.

This seems to be an issue introduced with version 0.1.24
replaced:
<plugin name="cordova-plugin-firebase" spec="^0.1.24" />
for:
<plugin name="cordova-plugin-firebase" spec="0.1.22" />
removed and readded the platform and is working fine!
No need to touch the plugin code

I used this command bellow:
$ cordova clean android

Related

google_maps_flutter does not work correctly on Android 11

I am using the google_maps_flutter package and whenever I click the button to launch the google map I encounter this error:
google maps is not installed or is disabled
But such a thing was not true :(((
This error is happened to me in Android 11.
please help me to solve this.
To fix this, you will need to add the Google Maps package "com.google.android.apps.maps" as an entry in your AndroidManifest.xml entry:
<manifest package="com.your.package">
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
...
</manifest>

ionic base64togallery plugin not working in android-targetSdkVersion 29

I'm using base64-to-gallery to save images for android devices in my ionic app.
Previously it was working fine but now after added <preference name="android-targetSdkVersion" value="29" />to config.xml file, under android platform, it's not working.
Please kindly help me with it.
Finally solved the issue. To anyone who is struggling, I will explain as below.
As mentioned in the git, https://github.com/Nexxa/cordova-base64-to-gallery , ionic Cordova base64togallery plugin has been discontinued.
And also when trying to submit the ionic mobile app for Android production, it's saying that the target SDK version should be more than 29.
But as usual, if we add <preference name="android-targetSdkVersion" value="29" /> to the config.xml file under the Android platform, it will not work the base64togallery plugin (not saving images to your device)
So you have to do like below,
In your ionic project, go to build.gradle file (platforms\android\build.gradle) and change defaultTargetSdkVersion and defaultCompileSdkVersion to 29. (as below)
defaultTargetSdkVersion=29
defaultCompileSdkVersion=29
And then go to AndroidManifest.xml file
(platforms\android\app\src\main\AndroidManifest.xml) and add android:requestLegacyExternalStorage="true" to the application tag, as showing below.
<application android:hardwareAccelerated="true" android:icon="#mipmap/ic_launcher" android:label="#string/app_name" android:networkSecurityConfig="#xml/network_security_config" android:requestLegacyExternalStorage="true" android:supportsRtl="true">
Then try to build your app for debug or release versions.

version conflict either by updating the version of the google-services plugin | Ionic

FAILURE: Build failed with an exception.
What went wrong:
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 9.0.0.
Easy solution is to install this updated plugin from my github account:
Remove fcm plugin:
ionic cordova plugin remove cordova-plugin-fcm-with-dependecy-updated
And install this updated version:
ionic cordova plugin add https://github.com/ishan123456789/cordova-plugin-fcm-with-dependecy-updated.git
If the above doesn't workout for you. The hard way
A solution for the above problem as seen in some channels is to:
Go to the plugins/cordova-plugin-fcm or plugins/cordova-plugin-fcm-with-dependency-updated then go to src/android/FCMPlugin.gradle
And replace:
classpath 'com.google.gms:google-services:3.1.+'
With
classpath 'com.google.gms:google-services:4.1.0'
And core to:
dependencies {
compile 'com.google.firebase:firebase-core:11.8.0'
}
And plugin.xml
<framework src="com.google.firebase:firebase-core:11.8.0" />
<framework src="com.google.firebase:firebase-messaging:11.8.0" />
The replace took place as per the google service higher version. In my case the conflict was with google plus plugin so I went to plugins/cordova-plugin-googleplus and there the google service version was
<preference name="PLAY_SERVICES_VERSION" default="11.8.0"/>
<framework src="com.google.android.gms:play-services-auth:$PLAY_SERVICES_VERSION" />
<framework src="com.google.android.gms:play-services-identity:$PLAY_SERVICES_VERSION" />
So from here the version 11.8.0 came.
https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/283
https://github.com/fechanique/cordova-plugin-fcm/issues/231
Google Play Services GCM 10.0.1 asks to “update” back to 9.0.0
https://github.com/fechanique/cordova-plugin-fcm/issues/499
https://github.com/fechanique/cordova-plugin-fcm/issues/306
This answer was quite resourceful
com.google.android.gms:play-services-measurement-base is being requested by various other libraries

Why Push Notification on Ionic, won't work when i build with Ionic Package?

Push Notification is not working when i build the application when i use the command ionic package build android --profile Profile and when i use ionic build android it work for me, but Why? i need to work with ionic package not with ionic build
This worked for me - see the bottom of this URL: https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PHONEGAP_BUILD.md
Users have reported issues with Ionic Cloud Build. Apparently there are some differences in the way variables are handled. If your app has an issue where the PushNotification object can't be found try the following.
Remove the inclusion of phonegap-plugin-push from config.xml. That is delete lines that look like this:
<plugin name="phonegap-plugin-push" spec="~1.9.1">
<variable name="SENDER_ID" value="xxx"/>
</plugin>
Add the following lines into package.json in the cordovaPlugins array.
{
"variables": {
"SENDER_ID": "xxx"
},
"locator": "phonegap-plugin-push"
}

Notification plugin not working phonegap 3.0 for iphone

I am developing an app with phonegap 3.0.0. I need to show the confirm dialog so I added the Notification plugin from phonegap CLI with the following command (as described in CLI Documentation):
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
But now I can't build the project. When I try to build it fails with following error:
** BUILD FAILED **
The following build commands failed:
CompileC build/CamTest.build/Debug-iphonesimulator/CamTest.build/Objects-normal/i386/CDVNotification.o CamTest/Plugins/org.apache.cordova.dialogs/CDVNotification.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
When I remove the Notification plugin everything works fine. I've also tried to add the following in my config.xml (CamTest/www/config.xml) to no effect:
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
Please someone tell me how to work with plugins in Phonegap 3.0.0. I am trying it on iphone simulator. Thanks.
We were facing the same problem, but before we added the required lines in config.xml. So, the following two step process also mentioned in this and this link solved the problem.
On the command line
$ cordova plugin add
https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
In project's config.xml
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>