aboozaid / react-native-wifi-hotspot

A react-native implementation for handling hotspot requests and make it easier to communicate with peers!
ISC License
40 stars 21 forks source link

Error running example #7

Closed luandro closed 5 years ago

luandro commented 5 years ago

I've been trying to run the example app. First I ran into some issues on how the libs are imported in Android. After fixing those, I'm now running into this issue:

> Task :react-native-wifi-hotspot:compileDebugJavaWithJavac
Note: /Users/react-native-wifi-hotspot/Example/node_modules/react-native-wifi-hotspot/android/app/src/main/java/reactnative/hotspot/HotspotManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :app:compileDebugJavaWithJavac FAILED
/Users/react-native-wifi-hotspot/Example/android/app/src/main/java/com/wifidirect/MainApplication.java:28: error: cannot find symbol
            new HotspotModule(),
                ^
  symbol: class HotspotModule
1 error

FAILURE: Build failed with an exception.
aboozaid commented 5 years ago

Are you sure you linked the library before running?

nebnes commented 5 years ago

I have the same error

jupmorenor commented 5 years ago

Same error, maybe you should join the classes in the same parent package

mmahdigh commented 5 years ago

I'm running to the same error. Anybody got a solution?!

jupmorenor commented 5 years ago

I've made a functional fork here https://github.com/AsharaStudios/react-native-wifi-hotspot but it's not available on npm, anyway you can install it using:

npm i asharastudios/react-native-wifi-hotspot

mmahdigh commented 5 years ago

@jupmorenor I tested your fork but doesn't work either. here is the full log:


C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:5: error: package com.android.dx does not exist
import com.android.dx.Code;
                     ^
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:6: error: package com.android.dx does not exist
import com.android.dx.DexMaker;
                     ^
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:7: error: package com.android.dx does not exist
import com.android.dx.FieldId;
                     ^
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:8: error: package com.android.dx does not exist
import com.android.dx.Local;
                     ^
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:9: error: package com.android.dx does not exist
import com.android.dx.MethodId;
                     ^
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:10: error: package com.android.dx does not exist
import com.android.dx.TypeId;
                     ^
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:26: error: cannot find symbol
    DexMaker dexMaker;
    ^
  symbol:   class DexMaker
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:78: error: cannot find symbol
    public void generateConstructorWorking(TypeId<?> declaringType, TypeId<?> superType){
                                           ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:78: error: cannot find symbol
    public void generateConstructorWorking(TypeId<?> declaringType, TypeId<?> superType){
                                                                    ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:95: error: cannot find symbol
    public void generateConstructor(TypeId<?> declaringType, TypeId<?> superType, FieldId<?,?> appCallbackFieldId){
                                    ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:95: error: cannot find symbol
    public void generateConstructor(TypeId<?> declaringType, TypeId<?> superType, FieldId<?,?> appCallbackFieldId){
                                                             ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:95: error: cannot find symbol
    public void generateConstructor(TypeId<?> declaringType, TypeId<?> superType, FieldId<?,?> appCallbackFieldId){
                                                                                  ^
  symbol:   class FieldId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:110: error: cannot find symbol
    public void generateCallbackMethod(TypeId<?> declaringType, FieldId<?,?> appCallbackFieldId, String method){
                                       ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:110: error: cannot find symbol
    public void generateCallbackMethod(TypeId<?> declaringType, FieldId<?,?> appCallbackFieldId, String method){
                                                                ^
  symbol:   class FieldId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:40: error: cannot find symbol
        TypeId<?> systemCallbackTypeId = TypeId.get(callbackClass);
        ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:40: error: cannot find symbol
        TypeId<?> systemCallbackTypeId = TypeId.get(callbackClass);
                                         ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:42: error: cannot find symbol
         dexMaker = new DexMaker();
                        ^
  symbol:   class DexMaker
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:45: error: cannot find symbol
        TypeId<?> tetheringCallback = TypeId.get("LTetheringCallback;");
        ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:45: error: cannot find symbol
        TypeId<?> tetheringCallback = TypeId.get("LTetheringCallback;");
                                      ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:50: error: cannot find symbol
        TypeId<OreoOnStartTetheringCallback> t = TypeId.get(OreoOnStartTetheringCallback.class);
        ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:50: error: cannot find symbol
        TypeId<OreoOnStartTetheringCallback> t = TypeId.get(OreoOnStartTetheringCallback.class);
                                                 ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:51: error: cannot find symbol
        FieldId<?,?> myCallbackFieldId = tetheringCallback.getField(t, "callback");
        ^
  symbol:   class FieldId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:79: error: cannot find symbol
        final MethodId<?, ?> superConstructor = superType.getConstructor();
              ^
  symbol:   class MethodId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:81: error: cannot find symbol
        MethodId<?, ?> constructor = declaringType.getConstructor(TypeId.INT);
        ^
  symbol:   class MethodId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:81: error: cannot find symbol
        MethodId<?, ?> constructor = declaringType.getConstructor(TypeId.INT);
                                                                  ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:82: error: cannot find symbol
        Code constructorCode = dexMaker.declare(constructor, Modifier.PUBLIC);
        ^
  symbol:   class Code
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:83: error: cannot find symbol
        final Local thisRef = constructorCode.getThis(declaringType);
              ^
  symbol:   class Local
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:96: error: cannot find symbol
        final MethodId<?, ?> superConstructor = superType.getConstructor();
              ^
  symbol:   class MethodId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:97: error: cannot find symbol
        TypeId<?> myCallbackTypeId = TypeId.get(OreoOnStartTetheringCallback.class);
        ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:97: error: cannot find symbol
        TypeId<?> myCallbackTypeId = TypeId.get(OreoOnStartTetheringCallback.class);
                                     ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:99: error: cannot find symbol
        MethodId<?, ?> constructor = declaringType.getConstructor(myCallbackTypeId);
        ^
  symbol:   class MethodId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:100: error: cannot find symbol
        Code constructorCode = dexMaker.declare(constructor, Modifier.PUBLIC);
        ^
  symbol:   class Code
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:101: error: cannot find symbol
        final Local thisRef = constructorCode.getThis(declaringType);
              ^
  symbol:   class Local
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:112: error: cannot find symbol
        MethodId onTetheringStarted = declaringType.getMethod(TypeId.VOID, method);
        ^
  symbol:   class MethodId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:112: error: cannot find symbol
        MethodId onTetheringStarted = declaringType.getMethod(TypeId.VOID, method);
                                                              ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:116: error: cannot find symbol
        Code code = dexMaker.declare(onTetheringStarted, Modifier.PUBLIC);
        ^
  symbol:   class Code
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:118: error: cannot find symbol
        final Local thisRef = code.getThis(declaringType);
              ^
  symbol:   class Local
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:121: error: cannot find symbol
        TypeId declaringTypeCallback = appCallbackFieldId.getDeclaringType();
        ^
  symbol:   class TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:122: error: cannot find symbol
        Local appCallback = code.newLocal(declaringTypeCallback);
        ^
  symbol:   class Local
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:128: error: cannot find symbol
        MethodId methodIdInAppCallback =  declaringTypeCallback.getMethod(TypeId.VOID, method, TypeId.VOID);
        ^
  symbol:   class MethodId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:128: error: cannot find symbol
        MethodId methodIdInAppCallback =  declaringTypeCallback.getMethod(TypeId.VOID, method, TypeId.VOID);
                                                                          ^
  symbol:   variable TypeId
  location: class CallbackMaker
C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\oreo\CallbackMaker.java:128: error: cannot find symbol
        MethodId methodIdInAppCallback =  declaringTypeCallback.getMethod(TypeId.VOID, method, TypeId.VOID);
                                                                                               ^
  symbol:   variable TypeId
  location: class CallbackMaker
Note: C:\Users\My PC\Desktop\Projects\testingHS\node_modules\react-native-wifi-hotspot\android\app\src\main\java\reactnative\hotspot\HotspotManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
42 errors
jupmorenor commented 5 years ago

@MahdiGhajary fixed on my repo Any issue please contact me.

mmahdigh commented 5 years ago

@jupmorenor I'm running into the initial error:

C:\Users\My PC\Desktop\Projects\testinghs2\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:51: error: cannot find symbol
      new HotspotModule()
          ^
  symbol:   class HotspotModule
  location: class PackageList
1 error

FAILURE: Build failed with an exception.

I'm using the latest version of RN (0.60.4), which version are you using?

jupmorenor commented 5 years ago

The react-native link sentence is not working properly, I don't know how to repair it, but if you look at MainApplication.java you can fix it manually changing the name of the class inside the getPackages() protected method. It should be new HotspotPackage() instead of new HotspotModule().

mmahdigh commented 5 years ago

@jupmorenor It finally WORKED! Thank you buddy!

aboozaid commented 5 years ago

Guys check you linked the library well I think you missed something with linking it.

I will close the repo as it already worked

TulshiDas39 commented 4 years ago

I am facing same issue.