You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 31, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 31, 2022. It is now read-only.
Issue when upgrading targetSdk and compileSdk to 29 #110
Compile time error after upgrading upgrading targetSdk and compileSdk to 29. Even though Q compatibility were supposed to be implemented in 0.12.3 (#92) — it seems that it is not.
Reacted by Riccardo Caprai, Bagus Budi Prakoso, Andrey Kandaurov, brunsy and Katarina Ljungdahl
@jkasten2 I still get this and I updated to last react native sdk and last gradle plugin.
I have an issue another module that seems to behave badly with sdk 28 and it needs 29.
Please fix this, because this makes a lot of our legacy (Cordova) Android projects impossible to build and it's almost impossible to rewrite every plugin in use to use AndroidX instead.
In fact, there was another cordova payment plugin causing the one signal plugin to throw the 28 warning. After removing the payment plugin, everything compiled ok with API 29.
Unfortunately the only solution I found is to "install" the gradle plugin to local maven repo and modify the gradle file that includes it... As long as maintainers don't release new version to maven it's probably the only solution...
For the specifics of updating it in the react-native plugin, you'd have to check with a dev that knows about that, for Cordova I can simply edit the relevant file at plugins/onesignal-cordova-plugin/build-extras-onesignal.gradle, which would become:
android.defaultConfig {
manifestPlaceholders = [
onesignal_app_id: '', // Use from js codeonesignal_google_project_number: 'REMOTE'
]
}
// Required for Android Support Library 26.0.0+ and Google Play services 11.+repositories {
maven { url 'https://maven.google.com' }
}
// Adding Onesignal-Gradle-Plugin to align gms, android support library, and firebase// dependencies between other plugins.// Source for Onesignal-Gradle-Plugin: https://github.com/OneSignal/OneSignal-Gradle-Pluginbuildscript {
repositories {
// See line 97 of build steps
maven { url uri('{here comes the path to the archive build when following the steps from link above}')}
}
dependencies {
// See line 100 of builld steps, the default line is incompatible with local build
classpath 'com.onesignal:onesignal-gradle-plugin:[0.12.8, 0.99.99]'
}
}
apply plugin: com.onesignal.androidsdk.GradleProjectPlugin
For React Native you could probably apply something similar...
Note this is by far not a clean solution, it's simply a temporary workaround so Cordova/React-Native/etc projects are still able to build without having to wait for all plugin devs to move to the new "AndroidX" support libraries...
@chancezeus thank you so much, I'll give it a shot soon and let you know. And yes, I know is not an "ideal" solution, but till we have it fixed we do what we can :)
Thanks again 😻
In fact, there was another cordova payment plugin causing the one signal plugin to throw the 28 warning. After removing the payment plugin, everything compiled ok with API 29.
Same issue here. After executing: ionic cordova plugin rm cc.fovea.cordova.purchase
It works again with API lvl 29.
But I need the In App Purchase plugin.. Any ideas?
I build my fix (and use the posted workaround) actually for a similar situation, so for now, that is your solution. The real solution would be a patch update of the plugin on Maven but that would depend on @jkasten2 and/or OneSignal.
I understand the general opinion regarding this (people should be using AndroidX when on api 29+), however for non-native developers using react native, cordova and/or similar frameworks, that is not always a solution since then they'd have to either update the plugins they use themselves and/or wait for the original developer to do so... And even though I'm a poly-glot when it comes to programming (languages), some of the projects I manage have more than a dozen plugins, most of which are not (yet) updated to use AndroidX, meaning that just fixing all those plugins myself would probably take me a week or more...
I build my fix (and use the posted workaround) actually for a similar situation, so for now, that is your solution. The real solution would be a patch update of the plugin on Maven but that would depend on @jkasten2 and/or OneSignal.
I understand the general opinion regarding this (people should be using AndroidX when on api 29+), however for non-native developers using react native, cordova and/or similar frameworks, that is not always a solution since then they'd have to either update the plugins they use themselves and/or wait for the original developer to do so... And even though I'm a poly-glot when it comes to programming (languages), some of the projects I manage have more than a dozen plugins, most of which are not (yet) updated to use AndroidX, meaning that just fixing all those plugins myself would probably take me a week or more...
Can you help me out with this line? maven { url 'https://plugins.gradle.org/m2/'}
Do I have to change it to: maven { url uri('../../repo') }
Or how do I solve this? I'm not really experienced in this.
I only get this SDK 29 issue when I have the "cc.fovea.cordova.purchase" plugin added.
If I remove that I don't get a OneSignal error anymore...
I build my fix (and use the posted workaround) actually for a similar situation, so for now, that is your solution. The real solution would be a patch update of the plugin on Maven but that would depend on @jkasten2 and/or OneSignal.
I understand the general opinion regarding this (people should be using AndroidX when on api 29+), however for non-native developers using react native, cordova and/or similar frameworks, that is not always a solution since then they'd have to either update the plugins they use themselves and/or wait for the original developer to do so... And even though I'm a poly-glot when it comes to programming (languages), some of the projects I manage have more than a dozen plugins, most of which are not (yet) updated to use AndroidX, meaning that just fixing all those plugins myself would probably take me a week or more...
Can you help me out with this line? maven { url 'https://plugins.gradle.org/m2/'}
Do I have to change it to: maven { url uri('../../repo') }
As indicated in the code segment here #110 (comment) you must change it to the path where the plugin got copied to, if it's indeed in ../../repo (relative to the installed gradle script) you can use that, otherwise you should put in the path that points to the exact folder where the compiled plugin resides (if (I assume windows here, but I'm not a windows user so I might be wrong regarding the exact paths, but it should give you an indication) for example the folder is in C:\Users\UserNameHere\My Documents\repo and your project is in C:\Projects\ProjectNameHere you should either enter C:/User/UserNameHere/My Documents/repo or ../../Users/UserNameHere/My Documents/repo).
Or how do I solve this? I'm not really experienced in this.
I only get this SDK 29 issue when I have the "cc.fovea.cordova.purchase" plugin added.
If I remove that I don't get a OneSignal error anymore...
Or how do I solve this? I'm not really experienced in this.
I only get this SDK 29 issue when I have the "cc.fovea.cordova.purchase" plugin added.
If I remove that I don't get a OneSignal error anymore...
The plugin needs to be updated to use AndroidX instead of "android.support", so if you have limited to no experience programming java and/or Android, all you can do is send put an issue on their Github asking the dev to update the plugin to use AndroidX instead of "android.support"...
@chancezeus I replaced "cc.fovea.cordova.purchase" with "cordova-plugin-purchase".
It's a replacement for fovea and works ok. I didn't have to change any code.
@chancezeus I am using one-signal plugin in ionic 5 project and facing same issue. Currently build-extras-onesignal.gradle file (path: plugins\onesignal-cordova-plugin) is same like you have described. But still getting same error. Is there any solution for this ?
I build my fix (and use the posted workaround) actually for a similar situation, so for now, that is your solution. The real solution would be a patch update of the plugin on Maven but that would depend on @jkasten2 and/or OneSignal.
I understand the general opinion regarding this (people should be using AndroidX when on api 29+), however for non-native developers using react native, cordova and/or similar frameworks, that is not always a solution since then they'd have to either update the plugins they use themselves and/or wait for the original developer to do so... And even though I'm a poly-glot when it comes to programming (languages), some of the projects I manage have more than a dozen plugins, most of which are not (yet) updated to use AndroidX, meaning that just fixing all those plugins myself would probably take me a week or more...
Can you help me out with this line? maven { url 'https://plugins.gradle.org/m2/'}
Do I have to change it to: maven { url uri('../../repo') }
As indicated in the code segment here #110 (comment) you must change it to the path where the plugin got copied to, if it's indeed in ../../repo (relative to the installed gradle script) you can use that, otherwise you should put in the path that points to the exact folder where the compiled plugin resides (if (I assume windows here, but I'm not a windows user so I might be wrong regarding the exact paths, but it should give you an indication) for example the folder is in C:\Users\UserNameHere\My Documents\repo and your project is in C:\Projects\ProjectNameHere you should either enter C:/User/UserNameHere/My Documents/repo or ../../Users/UserNameHere/My Documents/repo).
Or how do I solve this? I'm not really experienced in this.
I only get this SDK 29 issue when I have the "cc.fovea.cordova.purchase" plugin added.
If I remove that I don't get a OneSignal error anymore...
any chanche someone could indicate a correct path in windows cordova environment? i was unable to find the repo directory anywhere .... thank you
I think changes to be needed that are fixed in #92 . In the file - src/main/groovy/com/onesignal/androidsdk/GradleProjectPlugin.groovy and line no - 532 and 535 should not return directly the variable (LAST_MAJOR_ANDROID_SUPPORT_VERSION). It should be - maxSupportVersionObj[LAST_MAJOR_ANDROID_SUPPORT_VERSION].
Can anyone fix this and pushed on latest version ? It will be very helpful.
UPDATE: -@jkasten2 Please do the needful or let me know if it has been fixed in any latest release. Its very critical at my end.
Activity
keyheha commentedon Nov 13, 2019
I started with CompileSdkVersion 29, also got the same issue in latest version
OneSignalPlugin: WARNING: OneSignalPlugin: Downgraded 'com.android.support:29.0.0' -> 28 to prevent compile errors! Recommend updating your project's compileSdkVersion!
jkasten2 commentedon Mar 17, 2020
Google's last com.android.support library is 28. AndroidX should be used if you need to use API 29 features.
In most cases you can ignore this warning.
However if you are using AndroidX make sure you have Jetifier enabled by following this guide:
https://developer.android.com/jetpack/androidx
This is required when using OneSignal-Android-SDK 3.X.X.
rborn commentedon May 8, 2020
@jkasten2 I still get this and I updated to last react native sdk and last gradle plugin.
I have an issue another module that seems to behave badly with sdk 28 and it needs 29.
Any way I could enforce this? Thank you
beebase commentedon Aug 13, 2020
This is becoming critical. Google is going to force upgrade api level 29 soon.
OneSignalPlugin: WARNING: OneSignalPlugin: Downgraded 'com.android.support:28.0.0' -> 28 to prevent compile errors! Recommend updating your project's compileSdkVersion!chancezeus commentedon Aug 17, 2020
This has become critical because in the meantime Google has started requiring use of api level 29. The cause of the problem is here https://github.com/OneSignal/OneSignal-Gradle-Plugin/blob/master/src/main/groovy/com/onesignal/androidsdk/GradleProjectPlugin.groovy#L532 and here https://github.com/OneSignal/OneSignal-Gradle-Plugin/blob/master/src/main/groovy/com/onesignal/androidsdk/GradleProjectPlugin.groovy#L535. Instead of returning a valid (maven/gradle) version code, only "28" is returned (not 28.0.0 or 28.+) which in turn cascades to every android support dependency referencing the wrong version (namely version "28" exactly, not 28.0.0)...
Please fix this, because this makes a lot of our legacy (Cordova) Android projects impossible to build and it's almost impossible to rewrite every plugin in use to use AndroidX instead.
chancezeus commentedon Aug 17, 2020
Just to let you know, I verified locally this works by simply adding a
+ ".+"to both lines, will add a PR against my test repo for it...beebase commentedon Aug 17, 2020
In fact, there was another cordova payment plugin causing the one signal plugin to throw the 28 warning. After removing the payment plugin, everything compiled ok with API 29.
rborn commentedon Aug 20, 2020
@chancezeus thanks for this, do you know how we can use this in an existing project (react-native) where some other module depends on this one?
😻
chancezeus commentedon Aug 20, 2020
Unfortunately the only solution I found is to "install" the gradle plugin to local maven repo and modify the gradle file that includes it... As long as maintainers don't release new version to maven it's probably the only solution...
rborn commentedon Aug 20, 2020
@chancezeus thank you
@jkasten2 can we do something about this?
rborn commentedon Aug 20, 2020
@chancezeus could you explain how you did it ? My android-fu is non-existent 😅 😻
chancezeus commentedon Aug 20, 2020
Basically I followed these steps: https://github.com/OneSignal/OneSignal-Gradle-Plugin/blob/master/build.gradle#L93
For the specifics of updating it in the react-native plugin, you'd have to check with a dev that knows about that, for Cordova I can simply edit the relevant file at
plugins/onesignal-cordova-plugin/build-extras-onesignal.gradle, which would become:For React Native you could probably apply something similar...
Note this is by far not a clean solution, it's simply a temporary workaround so Cordova/React-Native/etc projects are still able to build without having to wait for all plugin devs to move to the new "AndroidX" support libraries...
rborn commentedon Aug 20, 2020
@chancezeus thank you so much, I'll give it a shot soon and let you know. And yes, I know is not an "ideal" solution, but till we have it fixed we do what we can :)
Thanks again 😻
Jay031 commentedon Aug 20, 2020
Same issue here. After executing:
ionic cordova plugin rm cc.fovea.cordova.purchaseIt works again with API lvl 29.
But I need the In App Purchase plugin.. Any ideas?
chancezeus commentedon Aug 20, 2020
I build my fix (and use the posted workaround) actually for a similar situation, so for now, that is your solution. The real solution would be a patch update of the plugin on Maven but that would depend on @jkasten2 and/or OneSignal.
I understand the general opinion regarding this (people should be using AndroidX when on api 29+), however for non-native developers using react native, cordova and/or similar frameworks, that is not always a solution since then they'd have to either update the plugins they use themselves and/or wait for the original developer to do so... And even though I'm a poly-glot when it comes to programming (languages), some of the projects I manage have more than a dozen plugins, most of which are not (yet) updated to use AndroidX, meaning that just fixing all those plugins myself would probably take me a week or more...
Jay031 commentedon Aug 21, 2020
Can you help me out with this line?
maven { url 'https://plugins.gradle.org/m2/'}Do I have to change it to:
maven { url uri('../../repo') }Or how do I solve this? I'm not really experienced in this.
I only get this SDK 29 issue when I have the "cc.fovea.cordova.purchase" plugin added.
If I remove that I don't get a OneSignal error anymore...
chancezeus commentedon Aug 21, 2020
As indicated in the code segment here #110 (comment) you must change it to the path where the plugin got copied to, if it's indeed in
../../repo(relative to the installed gradle script) you can use that, otherwise you should put in the path that points to the exact folder where the compiled plugin resides (if (I assume windows here, but I'm not a windows user so I might be wrong regarding the exact paths, but it should give you an indication) for example the folder is inC:\Users\UserNameHere\My Documents\repoand your project is inC:\Projects\ProjectNameHereyou should either enterC:/User/UserNameHere/My Documents/repoor../../Users/UserNameHere/My Documents/repo).chancezeus commentedon Aug 21, 2020
The plugin needs to be updated to use AndroidX instead of "android.support", so if you have limited to no experience programming java and/or Android, all you can do is send put an issue on their Github asking the dev to update the plugin to use AndroidX instead of "android.support"...
beebase commentedon Aug 21, 2020
@chancezeus I replaced "cc.fovea.cordova.purchase" with "cordova-plugin-purchase".
It's a replacement for fovea and works ok. I didn't have to change any code.
j3k0/cordova-plugin-purchase#1086
exneval commentedon Aug 27, 2020
any updates of #135 ?
Topiya commentedon Aug 29, 2020
@chancezeus I am using one-signal plugin in ionic 5 project and facing same issue. Currently build-extras-onesignal.gradle file (path: plugins\onesignal-cordova-plugin) is same like you have described. But still getting same error. Is there any solution for this ?
dariocarbone commentedon Sep 14, 2020
any chanche someone could indicate a correct path in windows cordova environment? i was unable to find the repo directory anywhere .... thank you
gauravpitaliya commentedon Sep 29, 2020
I think changes to be needed that are fixed in #92 . In the file - src/main/groovy/com/onesignal/androidsdk/GradleProjectPlugin.groovy and line no - 532 and 535 should not return directly the variable (LAST_MAJOR_ANDROID_SUPPORT_VERSION). It should be - maxSupportVersionObj[LAST_MAJOR_ANDROID_SUPPORT_VERSION].
Can anyone fix this and pushed on latest version ? It will be very helpful.
UPDATE: - @jkasten2 Please do the needful or let me know if it has been fixed in any latest release. Its very critical at my end.
jkasten2 commentedon Oct 12, 2020
This is now fixed in the latest 0.12.9 release!
Thanks for the reports and thanks to @chancezeus PR #135 to fix this
https://github.com/OneSignal/OneSignal-Gradle-Plugin/releases/tag/0.12.9
rborn commentedon Oct 14, 2020
@jkasten2 sorry to continue with this, but I still seem to have the issue.
I'm using the react-native module 3.9.1.
I there anything I need to do to make use of the last version?
jkasten2 commentedon Oct 29, 2020
@rborn Per step 3.2 ensure you have updated to the latest and have done a clean build.
https://documentation.onesignal.com/docs/react-native-sdk-setup#step-3---install-for-android-using-gradle-for-android-apps