1

Having a background as web developer, I have recently started with app development in react-native, using android-studio and struck at this gradle build error, when I try to run command:

react-native run-android

it outputs this:

cannot find symbol mInstabug.setUserName(username);

  • method setUserName(String)
  • location: variable mInstabug of type Instabug

  • Note: D:\my_project\node_modules\instab reactnative\android\src\main\java\com\instabug\react library\RNInstabugReactnativeModule.java uses or overrides a deprecated API.

  • Note: Recompile with -Xlint:deprecation for details.

Execution failed for task ':instabug-reactnative:compileReleaseJavaWithJavac'.

I am Currently Using:

Thanks in Advance

EvilTak
  • 7,091
  • 27
  • 36
Pavan Gangireddy
  • 417
  • 1
  • 3
  • 13

2 Answers2

2

I just ran into the same problem. I think I found the issue and can provide a temporary solution until the developer can update his module. If you refer to the link below we will likely get more feedback from the developer.

https://github.com/Instabug/instabug-reactnative/issues/36

The temporary solution:

In the RNInstabugReactnativeModule file located here on your machine:

D:\my_project\node_modules\instab reactnative\android\src\main\java\com\instabug\react library\RNInstabugReactnativeModule.java

starting at line 183:

@ReactMethod
public void setUserName(String username) {
    try {
        mInstabug.setUserName(username);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

change the try statement's mInstabug.setUserName to mInstabug.setUsername:

@ReactMethod
public void setUserName(String username) {
    try {
        mInstabug.setUsername(username);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

It looks like the developer changed the casing to be more consistent with iOS but I suppose it has not been updated on the mInstabug class yet.

0

This issue has been fixed in version 1.0.8. https://github.com/Instabug/instabug-reactnative/releases/tag/v1.0.8

Hossam Hassan
  • 665
  • 1
  • 8
  • 22