React-native-blur: [Android] Execution failed for task ':@react-native-community_blur:compileDebugJavaWithJavac'

Created on 3 Jul 2019  路  6Comments  路  Source: Kureev/react-native-blur

Compilation Bug

> Task :@react-native-community_blur:compileDebugJavaWithJavac FAILED
/Users/puma/wigo-mobile/node_modules/@react-native-community/blur/android/src/main/java/com/cmcewen/blurview/BlurViewManager.java:53: error: cannot find symbol
        if (context != null && context.getCurrentActivity() != null) {
                                      ^
  symbol:   method getCurrentActivity()
  location: variable context of type ThemedReactContext
/Users/puma/wigo-mobile/node_modules/@react-native-community/blur/android/src/main/java/com/cmcewen/blurview/BlurViewManager.java:54: error: cannot find symbol
          View viewToBlur = context.getCurrentActivity().findViewById(viewRef);
                                   ^
  symbol:   method getCurrentActivity()
  location: variable context of type ThemedReactContext
Note: /Users/puma/wigo-mobile/node_modules/@react-native-community/blur/android/src/main/java/com/cmcewen/blurview/BlurringView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

Environment info

info 
  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 116.12 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28, 29
        Build Tools: 23.0.1, 25.0.0, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.0, 28.0.2, 28.0.3
        System Images: android-25 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.1 AI-173.4819257
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.9 => 0.59.9 
    npmGlobalPackages:
      react-native-git-upgrade: 0.2.7

Library version: 3.3.1

Update: I created a new React Native project (version 0.59.10) and installed all dependencies successfully and confirmed that the Android project files were in sync, however the bug still exists.

Most helpful comment

I already have double quotes but still have the same error...

All 6 comments

Solved it! User error!

Instead of this:

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }

I had:

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url '$rootDir/../node_modules/react-native/android'
        }

Gradle files are written using Groovy syntax, and only double-quoted strings support variable interpolation.. so $rootDir was being taken literally and react-native wasn't being properly loaded, causing its API calls to fail.

I already have double quotes but still have the same error...

I'm getting this error using npx react-native run-android

Still have same error...

Same problem, anybody solve it?

Seeing this also while trying to upgrade from RN 0.59.10 to 0.60.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iagormoraes picture iagormoraes  路  6Comments

baicuhaha picture baicuhaha  路  4Comments

breadadams picture breadadams  路  5Comments

almirfilho picture almirfilho  路  3Comments

VicFrolov picture VicFrolov  路  7Comments