解决FLIR One Android Demo项目加载问题

前言

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项目,应该就可以成功编译了。

参考链接

  1. https://juejin.im/post/5acd6daaf265da238a30ca73#heading-8

你可能感兴趣的:(红外,Android)