Google service version conflict - ionic-framework

When I use these two plugins in ionic 1
cordova-plugin-fcm
cordova-plugin-googleplus
then this type of error occurs:
BUILD FAILED in 1s
11 actionable tasks: 1 executed, 10 up-to-date
Error: /home/idiosys/ionic/seeCheckFolder/SeeCheck/platforms/android/gradlew: Command failed with exit code 1 Error output:
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.
What can be the reason for these errors?

remove fcm, google plus
then install firebase plugin (https://ionicframework.com/docs/native/firebase/)
then install google plus.
remove and re-add android platform. it is work with me (ionic2).
Note: firebase contains notification functions , also with badge number : )

1 - Remove the entry from build.gradle:
// PLUGIN GRADLE EXTENSIONS START
apply from: "cordova-plugin-fcm/poc-FCMPlugin.gradle"
// PLUGIN GRADLE EXTENSIONS END
2 - specify proper versions for all other dependencies in project.properties file like:
cordova.system.library.1=com.google.firebase:firebase-core:10.2.0
cordova.system.library.2=com.google.firebase:firebase-messaging:10.2.0
cordova.system.library.3=com.google.android.gms:play-services-auth:10.2.0
cordova.system.library.4=com.google.android.gms:play-services-identity:10.2.0
3 - And bottom of build.gradle file add this line:
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
4 - Comment out all content of poc-fcmplugin.gradle file and instead of apply plugin: com.google.gms.googleservices.GoogleServicesPlugin use:
apply plugin: 'com.google.gms.google-services'
5 - Add classpath for google services in build.gradle classpath section like:
classpath 'com.google.gms:google-services:3.0.0'

Please refer to below mentioned app and make sure android dependencies are correct .
https://market.ionicframework.com/starters/ionic-google-plus-fcm-and-ad-banner
implementation "com.google.android.gms:play-services-auth:10.+"
implementation "com.google.android.gms:play-services-identity:10.+"
implementation "com.android.support:support-annotations:27.+"
implementation "com.google.firebase:firebase-core:10.+"
implementation "com.google.firebase:firebase-messaging:10.+"
implementation "com.google.android.gms:play-services-base:10.+"
implementation "com.google.android.gms:play-services-ads:10.+"

Related

when I'm trying to run in flutter project, but receiving the below warning

how to fix this warning?
Warning: Mapping new ns http://schemas.android.com/repository/android/co
mmon/02 to old ns http://schemas.android.com/repository/android/common/0
1
I think the issue is related to buildToolsVersion. Try downgrading its version:
Go to app > build.gradle
Right under compileSdkVersion, change buildToolsVersion("30.0.3") to buildToolsVersion("30.0.2")
If you don't find any buildToolsVersion inside your gradle file, please add it. (It uses the new version by default).

How to remedy error caused by guava: Program type already present: com.google.common.util.concurrent.internal.InternalFutures

An AAR library already uses com.google.guava.
If an app includes the following in its build.gradle:
api 'com.google.guava:guava:27.0-android'
Building the app generates the following error:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.google.common.util.concurrent.internal.InternalFutures
If I do not include "api 'com.google.guava:guava:27.0-android'", the app can be built, but it has runtime error of java.lang.NoClassDefFoundError when it reaches the point of using the Guava method: Iterables.find
I had to update to version 27.0.1, at the time of writing they still haven't updated the README with this new version.
implementation 'com.google.guava:guava:27.0.1-android'
Since Guava 27.0, ListenableFuture is located in separate artifact, see the announcement. You can try two things (one at a time):
Exclude "listenablefuture" module (group "com.google.guava") and build your project again.
I don't know the AAR specifics, but it could be that 27.0-android doesn't work with AAR, so you should try 26.0-android instead.

Unity3d, Appodeal, GooglePlayServices And Androit 65k method Limit

I'm having a problem trying to use Appodeal with GooglePlayServices and Unity3d, here are my steps:
1 - Import the GooglePlayServices package;
2 - Import the Appodeal package
3 - Compile the project.
Then the error:
CommandInvokationFailure: Gradle build failed
...
...
FAILURE: Build failed with an exception.
What went wrong
Execution failed for task ':transformClassesWithDexForRelease'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
...
...
This is about the android 65k methods limits. Right?
There is a way to solve this without having to use Proguard or export my project to Android Studio?
Thank You.
Thanks to Appodeal Support, i solved my problem:
1- Remove mmedia and inmobi folders from plugins/android.
2- Before initiliazation code of sdk, write:
Appodeal.disableNetwork("mmedia");
Appodeal.disableNetwork("inmobi");
my project was built perfectly after that

Facebook Sdk Android Error Building

I am trying to build my react-native project and using react-native fbsdk.
However, I get these errors:
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
:react-native-fbsdk:processReleaseResources FAILED
My current OS is Linux Elementary 0.4.1 Loki x64.
I am using react-native#0.37.0 and, because of this, react-native-fbsdk#0.4.0.
I've already tried:
cd android && ./gradlew clean
delete the project and re npm install it
and try in Android API's 23 and 24.
Apparently facebook has updated their sdk yesterday and the latest (4.23.0) sdk may have a bug or something.
You can resolve this by Changing your node_modules\react-native-fbsdk\android\build.gradle from:
compile('com.facebook.android:facebook-android-sdk:4.+')
To:
compile('com.facebook.android:facebook-android-sdk:4.22.1')
I'm no gradle guy so if someone knows of a better way of forcing the version from parent gradle.build, please comment and I'll update the answer.
** EDIT **
#Andreyco managed to solve this without changing node_modules. You can scroll down to his answer or click here.
Also, as notified by #JuanJoseTugores there's a pull request in react-native-fbsdk waiting to be approved, so you can check the bug's progress and be notified when it's resolved.
** Another Update **
Facebook closed the bug that was opened for them regarding this issue, saying they fixed the sdk. So now all the workarounds can be removed.
Apparently FB still not solved this. We just upgraded to RN 0.44 & FB 0.6.0
After digging into gradle, I came up with following solution.
Key is to exclude facebook-android-sdk required by react-native-fbsdk and pull in desired (working) version on facebook-android-sdk module - preferably without modifying anything in node_modules folder.
Fortunately, gradle offers this.
// android/app/build.gradle
dependencies {
compile(project(':react-native-fbsdk')){
exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
}
compile "com.facebook.android:facebook-android-sdk:4.22.1"
}
I was able to resolve this without modifying files under node_modules/.... I upgraded our react-native-fbsdk version to 0.6.0 and then add this to our application's build.gradle file to pin facebook-android-sdk at version 4.22.1:
project(':react-native-fbsdk') {
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.22.1'
}
}
}
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.22.1'
...
}
}
Edit: We are building with:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
...
}
I just encountered this error. First, RN Facebook SDK v.0.6.0 only works for react-native >= 0.44.0, so you have to update your dependency in package.json to react-native: ^0.44.0. Then go to Android build.gradle file and make this changes: compileSdkVersion 25 and compile "com.android.support:appcompat-v7:25.0.0"
this fixed for me
in android/build.gradle
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
}
}
}
}
For those who are looking for make it work using RN 0.42 which by now is the one with react version stable you may need to use the Facebook SDK 4.18.0 "com.facebook.android:facebook-android-sdk:4.18.0" which is the one that was released by the time that react-native-fbsdk#0.5.0 was released, otherwise you may be ending up with the issue: https://developers.facebook.com/bugs/1712442065726889/
Besides, if you are getting hard times to force the facebook sdk to be what you need try this:
android/app/build.gradle
...
dependencies {
compile project(':react-native-fbsdk')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile "com.facebook.android:facebook-android-sdk:[4.18.0)"
}
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project(':react-native-fbsdk') {
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.18.0'
}
}
}
...
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.18.0'
}
}
}
}
As you can see here there is patches incoming,
https://github.com/facebook/react-native-fbsdk/pull/339
https://github.com/facebook/react-native-fbsdk/pull/338
in the meantime if you're using react-native-fbsdk v0.5 you could do
yarn add react-native-fbsdk#https://github.com/tugorez/react-native-fbsdk
I've applied the suggested changes and it's working :) but please be aware I'll no support this and wont keep it update so... as soon as you can you should go back to the official library.

Cannot get Cordova project building in VS2015 with the facebook connect plugin

I've tried everything, but cannot seem to get it working. I've done the following:
1.Remove the plugins with the variables via the config designer.
2.Update to Cordova 5.0.0 via the config designer (Platforms > Cordova CLI)
3.From the command line: 1.Go to your project directory.
2.Type the following substituting the plugin name for the plugin you wish to add:
3.npm install -g cordova
4.cordova plugin add nl.x-services.plugins.launchmyapp --variable URL_SCHEME=myscheme
But I still cannot build. Here is the detailed output from MSBUILD :
http://pastebin.com/7enSzCxs
And a highlight of some of the errors I'm getting
1> BUILD FAILED
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
1> F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\com.phonegap.plugins.facebookconnect\myapp2568ddfac877478fb806edc911cff37e-FacebookLib\custom_rules.xml:4: F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\com.phonegap.plugins.facebookconnect\myapp2568ddfac877478fb806edc911cff37e-FacebookLib\ant-build does not exist.
And
1> BUILD FAILED
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:470: The following error occurred while executing this line:
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:441: Unable to delete directory F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\com.phonegap.plugins.facebookconnect\myapp2568ddfac877478fb806edc911cff37e-FacebookLib\bin
And finally
1>
1> F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\node_modules\q\q.js:126
1> throw e;
1> ^
1> Error code 1 for command: cmd with args: /s /c "ant debug -f F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\build.xml"
1> Command finished with error code 8: F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\build.bat --debug,--ant,
1>MDAVSCLI : error : F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\build.bat: Command failed with exit code 8
1>Done executing task "MdaVsCli" -- FAILED.
1>Done building target "BuildMDA" in project "fbtest.jsproj" -- FAILED.
1>Build FAILED.
Any ideas at all? Using a fresh install of VS2015 with the tools for cordova, trying to build for android.
EDIT:
So after taking the advice of Kamil Pajdzik below, I used build.bat to compile it and found some issues with my path being waaay to long. I mapped a drive to cut down the length and it will now build AOK from the build.bat.
Still no dice in Visual studio though (I assume this is difference between build.bat using gradle and vs using ant).
My only error now is :
1> -code-gen:
1> [mergemanifest] Merging AndroidManifest files into one.
1> [mergemanifest] Manifest merger disabled. Using project manifest only.
1> [echo] Handling aidl files...
1> [aidl] No AIDL files to compile.
1> [echo] ----------
1> [echo] Handling RenderScript files...
1> [echo] ----------
1> [echo] Handling Resources...
1> [aapt] Generating resource IDs...
1> [aapt] Z:\fbtest\platforms\android\bin\AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'value' with value '#string/fb_app_id').
1> [aapt]
1> [aapt] Z:\fbtest\platforms\android\bin\AndroidManifest.xml:15: error: Error: No resource found that matches the given name (at 'label' with value '#string/fb_app_name').
1> [aapt]
1>
1> BUILD FAILED
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:653: The following error occurred while executing this line:
1> C:\Users\Adam\AppData\Local\Android\android-sdk\tools\ant\build.xml:698: null returned: 1
1>
Okay, this appears to be the issue. There are two problems. The first is a max path size issue on Windows. The issue is that it the plugin uses part of the the app's ID to create a folder, and VS by default uses a random identifier that is fairly long so this exacerbates the issue.
To resolve:
Update the ID for your project to something short (com.myproject.short)
Move the project to the root of your drive
Go to the project folder and re-add the android platform. From the command line:
cordova platform remove android
cordova platform add android
The second issue that then remains is an "Ant" build seems to be missing a folder which likely is a bug. If you add the "ant-build" folder in the location it complains about the build succeeds.
Also - Be sure plugins/fetch.json is included in your checkins since this is where your plugin variables are stored. If that file is deleted, you'll need to remove and re-add the plugin again. From your update it sounds like either VS is still set to use Cordova 4.3.0 and/or plugins/fetch.json does not contain your plugin variables. You should see something like this if the plugin was added using Cordova 5.0.0:
{
"com.phonegap.plugins.facebookconnect": {
"source": {
"type": "registry",
"id": "com.phonegap.plugins.facebookconnect"
},
"is_top_level": true,
"variables": {
"APP_ID": "123",
"APP_NAME": "nbaer"
}
}
}
The "variables" section is what may be missing.
Try running F:\GIT\CordovaFb\BlankCordovaApp1\fbtest\platforms\android\cordova\build.bat from a command line. It usually gives more information.
Cordova 5.0.0 requires Android SDK in version 22. You can check if you have that installed via SDK manager.
This particular plugin appears to have some challenges with Cordova 5.0.0. Android underwent significant changes in this release that may be causing issues.
https://github.com/Wizcorp/phonegap-facebook-plugin/issues/1010
I am seeing failures if you build either with Ant or Gradle using a pure Cordova command line interface project. Likely a plugin fix is required to resolve the issue. I reccomend adding comments to this defect to help the plugin author resolve the issue.
So thanks to Chucks help, I managed to get a build working. It was indeed a combination of path length exceeding 260 characters (which I solved by mapping my solution directory to a drive) and a couple of folders not being created.
They were in my case :
F:\Git\CordovaFb\FBTest\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\bin\classes
and
F:\Git\CordovaFb\FBTest\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\ant-build
I seem to have to manually recreate these from time to time as they get deleted on some builds...
So the full process is as follows (for others who have the same issue)
1) Create your solution in as short a path as possible (map a drive if you need to)
2) Add your cordova project to the solution, double click config.xml, goto platforms and change the CLI version to 5.0.0
3) Fire up a command prompt in the solutions root
4) Type the following cordova plugin add https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID="00000000" --variable APP_NAME="My App"
5) When its done you'll have the plugin in the plugins dir and the fetch.json file should contain the variables you entered for appid and appname
6) Do a full build and you'll get some errors (Exit code 8)
7) Manually create the following :
[Solution Route]\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\bin\classes`
and
[Solution Route]\platforms\android\com.phonegap.plugins.facebookconnect\myapp7a29c6c80cee4b2aa0dc8a70dc57527d-FacebookLib\bin\classes`
8) Your build should succeed! Check periodically if those paths still exist.
This should get you by until the next release of the cordova tools for VS (if they fix it)
platforms\android\AndroidManifest.xml
just change android:minSdkVersion="14" to android:minSdkVersion="15"