簡體   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