[英]android studio, which import statement to use external libs?
我將EJML庫添加到了我的android studio項目中,但是我不知道import語句的樣子。
我的意思是,使用這些庫我必須寫些什么?
我的依賴:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
compile files('libs/EJML-core-0.30.jar')
compile files('libs/EJML-core-0.30-sources.jar')
compile files('libs/EJML-dense64-0.30.jar')
compile files('libs/EJML-dense64-0.30-sources.jar')
compile files('libs/EJML-denseC64-0.30.jar')
compile files('libs/EJML-denseC64-0.30-sources.jar')
compile files('libs/EJML-equation-0.30.jar')
compile files('libs/EJML-equation-0.30-sources.jar')
compile files('libs/EJML-simple-0.30.jar')
compile files('libs/EJML-simple-0.30-sources.jar')
compile files('libs/EJML-core-0.30-sources.jar')
}
在應用程序級別的build.gradle
文件中,您將有一個dependencies
部分。
請參閱如何將本地.jar文件依賴項添加到build.gradle文件? 欲獲得更多信息。
因此,在您的情況下,您將擁有:
dependencies {
... library files that are already there
compile files('libs/EJML-core-0.30.jar')
compile files('libs/EJML-core-0.30-sources.jar')
... the libraries in your libs folder will follow the same pattern
}
編輯:從評論中添加。
但我不知道導入語句的樣子:import ....
如果您只使用JAR
文件中的類,例如,如果我添加了RecyclerView
的依賴項(例如: compile 'com.android.support:recyclerview-v7:25.0.1'
: recyclerView = new RecyclerView()
compile 'com.android.support:recyclerview-v7:25.0.1'
: compile 'com.android.support:recyclerview-v7:25.0.1'
),那么我將調用RecyclerView
recyclerView = new RecyclerView()
等,它會要求您將其導入那里。 我不知道您已編譯的JARs
需要什么類。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.