Description:
Out of the blue two of our RN applications started to fail Android build. No changes were made to justify these failures.
Environment
System:
OS: macOS 11.2
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 42.75 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.4 - ~/.nvm/versions/node/v14.15.4/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.10 - ~/.nvm/versions/node/v14.15.4/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 11.0.9 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.63.4 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to Reproduce Issue:
Anything else:
Build failure stack trace:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all artifacts for configuration ':app:classpath'.
> Could not resolve gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99].
Required by:
project :app
> Unable to find a matching variant of gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.13.2:
- Variant 'apiElements' capability gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.13.2:
- Incompatible attributes:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Required org.gradle.usage 'java-runtime' and found incompatible value 'java-api'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.libraryelements 'jar' and found compatible value 'jar'.
- Found org.gradle.status 'release' but wasn't required.
- Variant 'runtimeElements' capability gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.13.2:
- Incompatible attribute:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.libraryelements 'jar' and found compatible value 'jar'.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.
@emilioheinz We are having same exact issue
@emilioheinz Same issue here. I think an update for onesignal-gradle-plugin was just released. We may be able to try to pin the version on a lower version in the buildscript dependencies inside build.gradle.
Same here
Okay so, the culprit is the most recent release of the gradle plugin: https://github.com/OneSignal/OneSignal-Gradle-Plugin/releases/tag/0.13.2
I managed to resolve this issue by changing my dependency range in my build.gradle for the classpath like so:
buildscript {
...
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.13.0]'
}
}
Probably need to wait until they fix it in the plugin, but I suppose this temporary fix works in the meantime.
Edit: Just noticed that the problem is probably in version 0.13.0 too, but that version was never released to the gradle portal, hence the reason that version range above works too. If you want to be on the safe side you could opt for the range onesignal-gradle-plugin:[0.12.6, 0.12.10]
Thank you @Hless your change works, hopefully we hear back from the devs soon.
Worked for me:
onesignal-gradle-plugin:[0.12.6, 0.12.10]
Thanks @Hless
Thanks for reporting! Java 8 compatibility has been fully restored in the onesignal-gradle-plugin 0.13.4 Release.
Re-sync gradle in Android Studio and /or performing a clean build should result in automatically upgrading.
Most helpful comment
Okay so, the culprit is the most recent release of the gradle plugin: https://github.com/OneSignal/OneSignal-Gradle-Plugin/releases/tag/0.13.2
I managed to resolve this issue by changing my dependency range in my build.gradle for the classpath like so:
Probably need to wait until they fix it in the plugin, but I suppose this temporary fix works in the meantime.
Edit: Just noticed that the problem is probably in version 0.13.0 too, but that version was never released to the gradle portal, hence the reason that version range above works too. If you want to be on the safe side you could opt for the range
onesignal-gradle-plugin:[0.12.6, 0.12.10]