我在安装库时遇到问题
I am having trouble with installing library
我正在尝试使用 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 here.
中添加依赖项
我正在尝试使用 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,构建没有问题,
但是我的代码仍然没有从库中找到 类,这意味着没有找到 类.
这是我第一次使用库,所以我可能漏掉了一些愚蠢的东西,但如果有人能告诉我它是什么,我将不胜感激。
对于您的情况,您需要在 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 here.
中添加依赖项