Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception is thrown in the code, but it works normally #14183

Closed
iamdurui opened this issue May 25, 2017 · 2 comments
Closed

Exception is thrown in the code, but it works normally #14183

iamdurui opened this issue May 25, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@iamdurui
Copy link

hf omj6 g6rh xz1a7nq6

when I create a native module in Android, throwing an exception , it is Method threw 'com.facebook.react.bridge.ObjectAlreadyConsumedException' exception. Cannot evaluate com.facebook.react.bridge.WritableNativeMap.toString()
my code is:
array=new WritableNativeArray();
for(int i=0;i<fileList.size();i++){
WritableMap map=new WritableNativeMap();
map.putString("uri","file://"+fileList.get(i).getAbsolutePath());
map.putString("fileName",fileList.get(i).getName());
map.putInt("size", (int) fileList.get(i).length());
array.pushMap(map);
}
callback.invoke(array);

  • React Native version: 0.39.0
  • Platform: Android
  • Development Operating System: Windows
  • Dev tools: Android Studio version 2.1.2,com.android.tools.build:gradle:2.2.3, buildToolsVersion "24.0.2"
    Although the error is appeared, but it is not crash, I want to be given a solution ,thanks
@hramos
Copy link
Contributor

hramos commented May 25, 2017

Hey, thanks for reporting this issue!

It looks like your description is missing some necessary information. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported.

I am going to close this, but feel free to open a new issue with the additional information provided. Thanks!

@hramos hramos closed this as completed May 25, 2017
@iamdurui
Copy link
Author

iamdurui commented May 26, 2017

@hramos
this code is
for(int i=0;i<fileList.size();i++){
WritableMap map=new WritableNativeMap();
map.putString("uri","file://"+fileList.get(i).getAbsolutePath());
map.putString("fileName",fileList.get(i).getName());
map.putInt("size", (int) fileList.get(i).length());
array.pushMap(map);
}
when i >0; the exception is thrown, I guess it is to be caused by the code(WritableMap map=new WritableNativeMap() ), Thanks!
41uii1 f 4 w6sz8 iy5i4g

pj7 wubfla58 l znza4q3

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants