在MainActivity.java React-native Android中找不到符号

时间:2017-10-05 06:56:46

标签: javascript java android react-native

我在反应原生应用程序中添加图像上传。我通过npm安装得很好并且很好地链接了它们

react-native link react-native-image-picker
react-native link react-native-image-resizer
react-native link react-native-fs

现在我每次尝试运行项目时都会遇到这些错误

  

任务:app:compileDebugJavaWithJavac   C:\项目\ aurity \ potatoo \土豆\机器人\程序\ SRC \主\ java中的\ com \ potato2 \ MainApplication.java:6:   错误:包com.rnfs不存在import com.rnfs.RNFSPackage;                  ^ C:\ projects \ aurity \ potatoo \ potato \ android \ app \ src \ main \ java \ com \ potato2 \ MainApplication.java:7:   错误:包fr.bamlab.rnimageresizer不存在导入   fr.bamlab.rnimageresizer.ImageResizerPackage;                                  ^ C:\ projects \ aurity \ potatoo \ potato \ android \ app \ src \ main \ java \ com \ potato2 \ MainApplication.java:8:   错误:包com.imagepicker不存在导入   com.imagepicker.ImagePickerPackage;                         ^ C:\ projects \ aurity \ potatoo \ potato \ android \ app \ src \ main \ java \ com \ potato2 \ MainApplication.java:30:   错误:找不到符号               新的RNFSPackage(),                   ^符号:类RNFSPackage C:\ projects \ aurity \ potatoo \ potato \ android \ app \ src \ main \ java \ com \ potato2 \ MainApplication.java:31:   错误:找不到符号               新的ImageResizerPackage(),                   ^符号:类ImageResizerPackage C:\ projects \ aurity \ potatoo \ potato \ android \ app \ src \ main \ java \ com \ potato2 \ MainApplication.java:32:   错误:找不到符号               新的ImagePickerPackage(),                   ^

     

symbol:class ImagePickerPackage

当我检查MainApplication.javaMainActivity.java时,我有包裹线。 任何一个帮助?我无法弄清楚为什么会发生这种情况和解决方案

1 个答案:

答案 0 :(得分:2)

在app / build.gradle中添加以下行修复了我的问题,

dependencies {
compile project(path: ':react-native-image-resizer')
compile project(path: ':react-native-fs')
compile project(path: ':react-native-image-picker')
}