我将 EJML 库添加到我的 android studio 项目中,但我不知道导入语句是什么样的。
我的意思是,我必须编写什么才能使用这些库?
我的依赖项:
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
部分。
参见 How to add local .jar file dependency to build.gradle file?了解更多信息。
所以在你的情况下你会:
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
}
编辑:从评论中添加。
but i dont know how the import statement looks like: import ....
如果您只是使用 JAR
文件中的类,例如,如果我为 RecyclerView
添加依赖项(例如:compile 'com.android .support:recyclerview-v7:25.0.1'
) 然后我会调用 RecyclerView
recyclerView = new RecyclerView()
等,它会要求你导入它在那里。我不知道您编译的JAR
需要哪些类。
关于java - android studio,哪个导入语句使用外部库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41287832/