react-native-popover-menu: Android "buildToolsVersion is not specified"

I did:

npm i react-native-popover-menu
react-native link react-native-popover-menu
react-native start
react-native run-android

But then the run-android command ends with:

PS C:\Users\Mercurius\Documents\GitHub\did> react-native run-android
Scanning folders for symlinks in C:\Users\Mercurius\Documents\GitHub\did\node_modules (47ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-popover-menu'.
      > buildToolsVersion is not specified.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I’ve solved this problem with the following modification in my android/build.gradle:

subprojects {
    afterEvaluate {
        project -> if (project.hasProperty("android")) {
            android {
                compileSdkVersion 26
                buildToolsVersion '26.0.2'
            }
        }
    }
}

And update my android/app/build.gradle with the following:

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

   ...other stuff
}

Hi @danielang + @Noitidart, I am closing this issue since it was fixed in the latest version and wanted to focus the open items.

Let me know in case you face any issue.

Thanks Pranav

Yes, I think so. Every other react-native library I saw provides this entries in their build.gradlefile. For example:

Thanks @danielang for sharing the fix.

In library build.gradle file buildToolsVersion is not specified, should we include it?

Thanks Pranav

Thanks @danielang! I will test this on the weekend when I get back, and report back.