Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

AGP detection with Version.ANDROID_GRADLE_PLUGIN_VERSION #146

Merged
merged 5 commits into from
Dec 7, 2020

Conversation

jkasten2
Copy link
Member

@jkasten2 jkasten2 commented Dec 7, 2020

Issue

The follow error prints for some Android projects when it should not.

Error compile android Please put onesignal-gradle-plugin first OR update to com.android.tools.build:gradle:3.0.0 or newer!

This was more common but didn't happen for all Cordova projects. See issues below:
https://github.com/OneSignal/OneSignal-Cordova-SDK/search?q=com.android.tools.build%3Agradle%3A3.0.0&type=issues

This wrong version detection was resulting in not only displaying this incorrect warning however setting gradleV2PostAGPApplyFallback = true which is an internal flag used from some fallback logic they may cause issues version rules not applying and resulting in not solving some mismatches as this plugin should.

Changes

  • com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION is a more reliable way to detect the AGP version.
  • Still using reading the jar's META-INF/MANIFEST.MF as a fallback
  • Lastly a new 3rd fallback to go off the Gradle version
    • AGP version from this just a likely assumption

NOTE: Change base to master after upgrade/apg_4.1.1_and_gradle_6.7.1 is merged

* Updated asset to latest version so tests pass
* `./gradlew wrapper --gradle-version=6.6.1 --distribution-type all`
* Updates to gradle-wrapper.jar and gradlew were intended as they were part of the Gradle update
* com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION is a more reliable way to detect the AGP version.
* Still using reading the jar's META-INF/MANIFEST.MF as a fallback
* Lastly a new 3rd fallback to go off the Gradle version
  - APG version from this just a likely assumption
@jkasten2 jkasten2 changed the base branch from master to upgrade/apg_4.1.1_and_gradle_6.7.1 December 7, 2020 10:32
@jkasten2 jkasten2 force-pushed the upgrade/apg_4.1.1_and_gradle_6.7.1 branch from fe5ae07 to f66dd37 Compare December 7, 2020 19:19
Base automatically changed from upgrade/apg_4.1.1_and_gradle_6.7.1 to master December 7, 2020 19:21
@jkasten2 jkasten2 merged commit 32bcc6f into master Dec 7, 2020
@jkasten2 jkasten2 deleted the fix/agp_version_detection branch December 7, 2020 19:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants