[英]android studio jar import problems
我是android開發的大一新生,並且希望通過一些jars使用webservice。(該webservice已被編寫和發布)。 然后,我使用Ksoap.jar和Jsoup.jar。 在android studio中。 我嘗試導入它們。 它顯示成功,但是我仍然無法使用jar中的類。
build.gradle顯示如下:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile files('libs/ksoap2-android-3.4.0.jar')
compile files('libs/jsoup-1.8.3-sources.jar')
}
但是在我的活動中,我仍然無法導入它們。 我怎么解決這個問題? 它使我發瘋。
你不需要
compile files('libs/ksoap2-android-3.4.0.jar')
compile files('libs/jsoup-1.8.3-sources.jar')
只要您在libs文件夾中有這些jar文件,此gradle行就會將它們包含在您的項目中。
compile fileTree(dir: 'libs', include: ['*.jar'])
它說:“為libs/
目錄中的每個jar文件進行編譯。” 有另外兩條線是多余的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.