java - 我在安装库时遇到问题
问题描述
我正在尝试使用jlatemath库。
我已将 .jar 文件放在 libs 文件夹下,这是我的 gradle。
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('libs/jlatexmath-android-0.1.0-sources.jar')
implementation files('libs/jlatexmath-android-font-cyrillic-0.1.0-sources.jar')
implementation files('libs/jlatexmath-android-font-greek-0.1.0-sources.jar')
}
我不认为我需要两者,但我只是为了确定。
我尝试清理并重建项目。
没有runtask,构建没有问题,
但我的代码仍然没有从库中找到类,这意味着没有找到类的自动导入。
这是我第一次使用图书馆,所以我可能错过了一些愚蠢的东西,但如果有人能告诉我它是什么,我将不胜感激。
解决方案
我刚刚注意到的是您正在尝试手动下载和添加依赖项。这是一个非常漫长而令人厌烦的过程!您可以粘贴并让 android studio 为您完成。
对于您的情况,您需要在 build.gradle 添加这些行
implementation 'ru.noties:jlatexmath-android:0.1.0'
// for Cyrillic symbols
implementation 'ru.noties:jlatexmath-android-font-cyrillic:0.1.0'
并同步项目。不要忘记删除之前手动添加依赖项的所有行。
所以你在问题中的代码应该如下所示
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//PASTE HERE DEPENDENCIES
implementation 'ru.noties:jlatexmath-android:0.1.0'
// for Cyrillic symbols
implementation 'ru.noties:jlatexmath-android-font-cyrillic:0.1.0'
}
如果它没有解决您的问题,请告诉我。
如果您更喜欢视频教程,您可以按照本教程了解如何在 android studio 中添加依赖项。
推荐阅读
- react-native - 如何在抽屉导航屏幕中传递参数?
- nginx - 有关 Nginx 如何在 Google 计算引擎上使用 SSL 的详细信息
- r - R中混合lmer模型的警告消息
- react-native - react-native-admob:compileDebugJavaWithJavac 失败
- python - 如何配置 Python 并组织我的解释器?
- docker - 从 Liferay 7.3 中的角色删除权限
- video - 使用 ffmpeg 进行动态转码和 HLS 流式传输
- javascript - 这个反应代码中的错误是什么?当我在第 1 部分中调用该函数时,它不起作用,但第 2 部分有效
- generics - Kotlin:在函数中传递用于 filterIsInstance 的类类型
- python - 使用 fipy 跨域耦合 pdes