繁体   English   中英

我在安装库时遇到问题

[英]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中这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM