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

Fixed Gradle setup #17

Merged
merged 1 commit into from
Jun 6, 2020
Merged

Fixed Gradle setup #17

merged 1 commit into from
Jun 6, 2020

Conversation

SaeedZhiany
Copy link
Contributor

Summary

  • Load Android Gradle Plugin conditionally

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.

  • set root project's Gradle config instead of hardcoded configs (with fallback option)

  • remove buildToolsVersion config, because it's no longer necessary with newer versions of the Android Gradle plugin.

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
Contributor Author

@jhen0409

please review and merge this.

@jhen0409 jhen0409 merged commit 1ce963c into jhen0409:master Jun 6, 2020
@jhen0409
Copy link
Owner

jhen0409 commented Jun 6, 2020

Thank you!

@SaeedZhiany SaeedZhiany deleted the patch-1 branch June 6, 2020 09:17
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