将.jar文件添加到React native [英] Adding .jar files to React native
问题描述
我正在尝试为React Native创建一个本机模块。我要构建的Native模块基于 Sinch 。当我添加Sinch libary时,需要一些.jar文件并在Android Studio中选择Add as library。当我尝试将我的项目添加到Android Studio并添加Sinch时,我收到此错误:需要未知模块ReactPerf。如果您确定该模块在那里,请尝试重新启动打包器或运行npm install
I am trying to make an native module for React Native. The Native module I am going to build is based on Sinch. When I am adding the Sinch libary one needs to some .jar files and select "Add as library" in Android Studio. When I try to add my project to Android Studio and add Sinch I get this error: requiring unknown module "ReactPerf". If you are sure the module is there, try restarting the packager or running "npm install"
并且仿真器如下所示: eumlator
有没有人有通过Android将.jar文件添加到他们的项目的经验工作室或其他什么?或者有人知道如何解决这个错误吗?
and the emulator looks like this: eumlator Do anyone have any experience on adding .jar files to their project either through Android Studio or something else? Or do someone know how I can fix this error?
推荐答案
在YouProjectName / android / app / build.gradle文件中,有一行代码:
In "YouProjectName/android/app/build.gradle" file, there is one line code:
compile fileTree(dir: "libs", include: ["*.jar"])
这意味着你可以将* .jar文件添加到YouProjectName / android / app / libs中夹。祝你好运。
It means you can add you "*.jar" files into "YouProjectName/android/app/libs" folder. Good luck.
这篇关于将.jar文件添加到React native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!