Closed eftas-apps closed 6 years ago
Unfortunately, I don't have time to setup whole new project to testing it out. If you could create a simple repo demonstrating the problem, I would clone and see if could find any fix.
@ratson I replace this code: cordova.system.library.8=com.google.android.gms:play-services-base:11.0.4 cordova.system.library.9=com.google.android.gms:play-services-ads:11.0.4
in project.properties
With this: cordova.system.library.8=com.google.android.gms:play-services-base:11.+ cordova.system.library.9=com.google.android.gms:play-services-ads:11.+
And: BUILD SUCCESSFUL
You've got info about this in the README:
Customize Google Play Services versions (Android only)
The default
PLAY_SERVICES_VERSION
is set to11.0.4
. If you need a different version, editconfig.xml
with following,<plugin name="cordova-admob-sdk" spec="~0.13.1"> <variable name="PLAY_SERVICES_VERSION" value="11.6.0" /> </plugin>
@rafaellop I already mentioned that I tried that and that it did not help. Setting the play-services handles another issue. @ivanov84 is your post related to my issue? I'm not sure how to include your answer in my code. @ratson basically it's just creating a simple cordova app, adding phonegap-plugin-push, adding this plugin and trying to build it on android (I use 6.4.0). The build process will not succeed.
oh, and my apologies. Thanks for your quick answers!
@eftas-apps Can you show me your platform/android/project.properties
Hi @tominou
thanks for your help. I pasted some files you might feel interesting.
config.xml (parts)
<plugin name="phonegap-plugin-push" spec="^2.1.3">
<variable name="FCM_VERSION" value="11.6.2" />
</plugin>
<plugin name="cordova-admob-sdk" spec="^0.15.1">
<variable name="PLAY_SERVICES_VERSION" value="11.6.2" />
</plugin>
<plugin name="cordova-plugin-admob-free" spec="^0.15.0" />
<engine name="android" spec="~6.4.0" />
project.properties
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-base:11.0.4
cordova.system.library.2=com.google.android.gms:play-services-ads:11.0.4
cordova.system.library.3=com.android.support:support-v13:26.+
cordova.system.library.4=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.5=com.google.firebase:firebase-messaging:11.6.2
cordova.gradle.include.1=phonegap-plugin-push/duelmenerzeitung-push.gradle
duelmenerzeitung-push.gradle
import java.util.regex.Pattern
def doExtractStringFromManifest(name) {
def manifestFile = file("AndroidManifest.xml")
if (!manifestFile.exists()) {
manifestFile = file("src/main/AndroidManifest.xml")
}
def pattern = Pattern.compile(name + "=\"(.*?)\"")
def matcher = pattern.matcher(manifestFile.getText())
matcher.find()
return matcher.group(1)
}
android {
defaultConfig {
multiDexEnabled true
applicationId = doExtractStringFromManifest("package")
}
}
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
ext.postBuildExtras = {
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}
Thanks for your support!
Hi @eftas-apps
Edit your project.properties
as follow:
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-base:12.0.1
cordova.system.library.2=com.google.android.gms:play-services-ads:12.0.1
cordova.system.library.3=com.android.support:support-v13:26.+
cordova.system.library.4=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.5=com.google.firebase:firebase-messaging:12.0.1
cordova.gradle.include.1=phonegap-plugin-push/duelmenerzeitung-push.gradle
Then try to build.
Hi @tominou
seems gradle does not find the library. Do I need to add another repo?
Could not find com.google.android.gms:play-services-base:12.1.0 Could not find com.google.android.gms:play-services-ads:12.1.0 Could not find com.google.firebase:firebase-messaging:12.1.0. Could not find com.google.firebase:firebase-core:12.1.0
Update: seems to work with 12.0.0 but gives me this error
BUILD FAILED in 18s
39 actionable tasks: 37 executed, 2 up-to-date
(node:1384) UnhandledPromiseRejectionWarning: Error: .../platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/cliffpereira/Documents/git/2852-DuelmenerZeitung-App/platforms/android/src/name/ratson/cordova/admob/rewardvideo/RewardVideoListener.java:13: error: RewardVideoListener is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener
class RewardVideoListener implements RewardedVideoAdListener {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/cliffpereira/Documents/git/2852-DuelmenerZeitung-App/platforms/android/src/com/adobe/phonegap/push/PushPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Sorry for the wrong version. The latest is 12.0.1 indeed. Please remove the plugin then add it back, a bug has been fixed recently.
@tominou
Thanks a lot! That did the trick.
Although this seems like a tiny hack, I'll close the issue. This might help others having the same issue.
Actually you can set the play service version in your config.xml
`
`
But it also depends on other plugins so we can not help more about it
I did that already. See my post further up where I posted parts of my config.xml. Unfortunately that did not help.
Yes because of the plugin using com.google.firebase:firebase-messaging
you need to configure it to use the same version of play services (12.0.1), either in your config.xml
or project.properties
if there is not option to do it in config.xml.
However i am glad it is now working for you ^^
Use this plugin, it works for me: https://www.npmjs.com/package/cordova-play-services-version-adapter
Hi,
first of all I'd like to say that this plugin is superb and works as supposed. When digging deeper, I wanted to use push notification via firebase. I used phonegap-plugin-push. Unfortunately following error occurs.
In the GitHub push plugins GitHub page following is stated.
Seems I could narrow it down to this plugin causing this error. Using one of the plugins works fine. But both together give a problem. Is there any possible solution?
P.S.: I already tried changing the play-services version as hinted in the readme.