前言
FLIR官網上有四個demo,可以供我們參考。我這裏買的是Android版本的,所以使用的是Android Studio進行構建,版本是3.5.0,比較新了。
但是因爲需要引入外部的一些依賴以及第三方文件,demo一開始一直無法順利編譯。因此我們需要進行一些操作。
流程
1.添加阿里鏡像
Android是通過gradle構建的,一開始你的Project的build.gradle
文件中是這麼寫的。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
由於網絡的原因,這些官方庫加載十分緩慢,導致構建無法完成,因此我們需要添加阿里的鏡像,使其能夠更加高效地完成加載。
在上面兩處repositoryies
中添加一行:
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
jcenter()
google()
2.外部aar文件添加
在app的build.gradle
中有這樣一段話:
repositories {
// default path where thermalsdk AAR is stored
flatDir dirs: '../../../modules/thermalsdk/build/outputs/aar'
// default path where androidsdk AAR is stored
flatDir dirs: '../../../modules/androidsdk/build/outputs/aar'
// superproject path where all required AARs are stored (for local debug builds only)
flatDir dirs: '../../../MastodonAndroid/prebuilt-aar'
}
這樣我們就知道了之前爲什麼編譯不通過了,因爲缺少了相對應的文件。所以我們只要創建對應的文件夾,然後將下載好的aar文件放入其中就可以了。當然要注意的是..
,表示上一層,這個層級有點多,注意不要改錯。添加文件之後重新import項目,應該就可以成功編譯了。
參考鏈接
- https://juejin.im/post/5acd6daaf265da238a30ca73#heading-8