Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Android Gradle Plugin conditionally #56

Closed
wants to merge 1 commit into from
Closed

Load Android Gradle Plugin conditionally #56

wants to merge 1 commit into from

Conversation

SaeedZhiany
Copy link

Summary

This wraps the Android Gradle plugin dependency in the buildscripts section of android/build.gradle in a conditional:

if (project == rootProject) {
    // ... (dependency here)
}

The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).

for more info, you can refer to this thread and especially this comment.

Test Plan

Suppose you use this library on a project that has a different AGP version than this library's AGP version and the latter one is not installed on the OS. by this change, the library's AGP will not download during the build process (which it shouldn't be)

What's required for testing (prerequisites)?

An OS that has not installed the Android Gradle Plugin version that this library already using.

What are the steps to reproduce (after prerequisites)?

Just import this library in a project and run it on an Android emulator or a real device

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@SaeedZhiany
Copy link
Author

@FonDorn

Please review and merge this.

Thanks

@FonDorn
Copy link
Collaborator

FonDorn commented Apr 13, 2020

Thanks for this PR. Changes were added into #60

@FonDorn FonDorn closed this Apr 13, 2020
@SaeedZhiany
Copy link
Author

Nice,

I just checked that PR, you could also bump the AGP version to 3.6.2 which is 3.3.1 currently. I can rebase this PR to bumping that version if you want.

@FonDorn
Copy link
Collaborator

FonDorn commented Apr 14, 2020

@SaeedZhiany There is a need to bump the AGP version?

@SaeedZhiany
Copy link
Author

No actually, with the condition, users' projects will ignore this library's AGP version and it's no matter for their projects. I suggest bumping the version to keep the library's dependency up-to-date.

@SaeedZhiany SaeedZhiany deleted the patch-1 branch April 21, 2020 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants