-
Notifications
You must be signed in to change notification settings - Fork 17
Issue when upgrading targetSdk and compileSdk to 29 #110
Comments
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! |
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: This is required when using OneSignal-Android-SDK 3.X.X. |
@jkasten2 I still get this and I updated to last react native sdk and last gradle plugin. Any way I could enforce this? Thank you |
This is becoming critical. Google is going to force upgrade api level 29 soon.
|
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. |
Just to let you know, I verified locally this works by simply adding a |
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. |
@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? |
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... |
@chancezeus thank you @jkasten2 can we do something about this? |
@chancezeus could you explain how you did it ? My android-fu is non-existent 😅 😻 |
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 android.defaultConfig {
manifestPlaceholders = [
onesignal_app_id: '', // Use from js code
onesignal_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-Plugin
buildscript {
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 :) |
Same issue here. After executing: It works again with API lvl 29. |
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? Or how do I solve this? I'm not really experienced in this. |
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
|
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". |
any updates of #135 ? |
@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 ? |
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. |
This is now fixed in the latest 0.12.9 release! |
@jkasten2 sorry to continue with this, but I still seem to have the issue. I there anything I need to do to make use of the last version? |
@rborn Per step 3.2 ensure you have updated to the latest and have done a clean build. |
Project Setup
build.gradle
Full Error
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.
The text was updated successfully, but these errors were encountered: