我目前正在 android studio 中编写一个 android 应用程序。作为我的应用程序的一部分,我想使用 exp4j 库:
import net.objecthunter.exp4j.Expression;
import net.objecthunter.exp4j.ExpressionBuilder;
这是我用来尝试导入它的两行代码。我已经从 exp4j 网站下载了 .jar 文件,但是当我尝试运行这些文件时没有任何反应。该库仍在使用并且可下载版本可以使用吗?
还有没有办法在不使用网站上的 .jar 文件的情况下安装它?可以从 Git 安装吗?
非常感谢任何提示。
亲切的问候, 本
编辑:
我已将以下内容添加到我的依赖项中,但 exp4j 变量仍然无法识别。
您可以尝试以下步骤在您的android studio项目中添加exp4j。
从官方网站下载 exp4j 二进制 jar。 下载
通过复制app/libs文件夹中的jar文件将exp4j导入到android studio中。
在模块 build.gradle 文件依赖项中添加以下行。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
...
}
这个工作正常了...
在重新加载我的项目后,添加依赖项并从我的主目录中删除导入,将其解决。
您可以尝试以下步骤在您的android studio项目中添加exp4j。
从官方网站下载 exp4j 二进制 jar。 通过复制 app/libs 文件夹中的 jar 文件将 exp4j 导入 Android studio。 https://jar-download.com/artifacts/net.objecthunter/exp4j/0.4.8/source-code#google_vignette
现在观看此 YouTube 视频并按照以下步骤操作 https://www.youtube.com/shorts/l9YNW14Ppes