Aminoid / react-native-activity-recognition

React Native wrapper for the Activity Recognition API.
GNU General Public License v2.0
93 stars 80 forks source link

error when build #6

Closed phalla-khong closed 6 years ago

phalla-khong commented 6 years ago

Hi, i got error when build

: method does not override or implement a method from a supertype @Override ^ Note: D:\projects\MyAct\node_modules\react-native-activity-recognition\android\s rc\main\java\com\xebia\activityrecognition\DetectionService.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error :react-native-activity-recognition:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

who know how to solve this problem, thank you.

Gp2mv3 commented 6 years ago

Simply remove the java function, it's because of a change in RN 0.47 (if my memory is good).

phalla-khong commented 6 years ago

Finally i can solve my problem by modify some code:

  1. in file "react-native-activity-recognition/android/build.gradle": I changed dependencies
    from: compile 'com.google.android.gms:play-services:+' to: compile 'com.google.android.gms:play-services-location:10.0.1'
  2. in file "react-native-activity-recognition/android/src/main/java/com/xebia/activityrecognition/RNActivityRecognitionPackage.java" I removed code bellow: @Override public List<Class<? extends JavaScriptModule>> createJSModules() { return Collections.emptyList(); }

Now it work :)

aswinramakrish commented 6 years ago

Following @phalla-khong's solution, just wanted to clarify a couple of things -

  1. Don't remove the entire function, but just remove the @Override keyword above the function. The bolded text wasn't clear and I ended up deleting the function without paying attention.

  2. Make sure 10.0.1 in his solution matches with the Google Play services version you're using, otherwise you might end up getting an error like -

    Build failure: duplicate entry: com/google/android/gms/auth/api/signin/zzm.class