react-native-geolocation icon indicating copy to clipboard operation
react-native-geolocation copied to clipboard

react.module.annotations does not exist

Open vikramkh opened this issue 6 years ago • 5 comments

Environment

System: OS: macOS 10.14.5 CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz Memory: 32.03 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.10.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 Android SDK: API Levels: 28 Build Tools: 26.0.2, 27.0.3, 28.0.3, 29.0.1 System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.60.5 => 0.60.5 npmGlobalPackages: react-native-cli: 2.0.1

Platforms

This is for android only

Versions

  • Android: 9 (Pie)
  • react-native-geolocation: 2.0.2
  • react-native: 0.60.5
  • react: 16.8.6

Description

I just started to use React native community geolocation. It works fine with iOS, but for android it gives me these errors:

Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:33: error: package com.facebook.react.module.annotations does not exist
import com.facebook.react.module.annotations.ReactModule;
/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:35: error: package com.facebook.react.modules.permissions does not exist
import com.facebook.react.modules.permissions.PermissionsModule;
                                             ^
/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:42: error: cannot find symbol
@ReactModule(name = GeolocationModule.NAME)
 ^
  symbol: class ReactModule
/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:128: error: cannot find symbol
      final PermissionsModule perms = getReactApplicationContext().getNativeModule(PermissionsModule.class);
            ^
  symbol:   class PermissionsModule
  location: class GeolocationModule
/node_modules/@react-native-community/geolocation/android/src/main/java/com/reactnativecommunity/geolocation/GeolocationModule.java:128: error: cannot find symbol
      final PermissionsModule perms = getReactApplicationContext().getNativeModule(PermissionsModule.class);
                                                                                   ^
  symbol:   class PermissionsModule
  location: class GeolocationModule
5 errors

I tried cleaning, rebuilding, reinstalling node modules, etc. Nothing works. However, in Android studio, I do see this error in the "Sync":

ERROR: The modules ['@react-native-community_geolocation', 'react-native-community-geolocation'] point to the same directory in the file system.
Each module must have a unique path.

Not sure if this is related or a completely different problem.

I didn't do much to get this error, just npm installed react-native-community/geolocation and followed the instructions

Reproducible Demo

vikramkh avatar Aug 27 '19 19:08 vikramkh

Any updates on this? Ran into the same issue while upgrading React Native to 0.60.5. Version of rn-geolocation is 2.0.2

axeff avatar Sep 02 '19 11:09 axeff

Having the same issue on the latest react-native and rn-geo plugin

arpitjacob avatar Sep 04 '19 14:09 arpitjacob

Hello all,

Having the same issue here after upgrading RN to 0.61.2 and geolocation to 2.0.2. Any progress or workarounds except downgrading?

OlegNovosad avatar Oct 11 '19 13:10 OlegNovosad

@OlegNovosad

possible solution to the problem. The commend is hidden, so you need to open it

sunnylqm says:

You should check upgrade-helper carefully to see if you missed any config. Especially something like https://github.com/facebook/react-native/blob/master/template/android/settings.gradle#L2 and https://github.com/facebook/react-native/blob/master/template/android/app/build.gradle#L209 And do not use react-native link command any more.

and the relevant discussion in the react native repository.

I may have been able to solve the problem by giving particular attention to all android files and the respective upgrade steps from upgrade-helper

In particular MainApplication.java and app/build.gradle

I unlinked/removed all the dependencies in my projects causing errors. Then an error was triggered from MainApplication.java relative to ReactApplication and ReactNativeHost.

The issue was with the configurations of my android files, missing dependencies etc..

fabOnReact avatar Dec 29 '19 11:12 fabOnReact

after upgrading to 0.64.0

I applied for mistead the diff android/build.gradle in https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.64.0

I replaced

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

with maven { url 'https://www.jitpack.io' }

and caused this error again. reverting the change fixed it

fabOnReact avatar Apr 02 '21 22:04 fabOnReact