我正在尝试为 FLIR One Pro 热像仪的移动应用程序同步示例项目。他们提供的示例代码需要在示例项目中导入两个 .AAR 模块以满足依赖关系。
不幸的是,他们提供的 .AAR 模块甚至没有 build.gradle 文件,所以我不得不自己编写这些文件。但是在纠正了所有问题之后,当我同步我的项目时,我在 Android Studio 中不断遇到同样的问题。
同步/构建的错误与标题相同:Unable to resolve dependency for ':@debug/compileClasspath': Could not resolve project :androidsdk-release
我的项目设置为:
app/
libs/
thermalsdk-release.aar
androidsdk-release.aar
build.gradle
这是我的应用程序 build.gradle
buildscript {
repositories {
google() // For Gradle 4.0+
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
defaultConfig {
applicationId "com.samples.flironecamera"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
// add Thermal SDK 'aar' library located under 'modules/thermalsdk/build/outputs/aar'
// add Thermal SDK for Android 'aar' library located under 'modules/thermalsdk/build/outputs/aar'
//implementation(name: 'androidsdk-release', ext: 'aar')
//implementation(name: 'thermalsdk-release', ext: 'aar')
implementation project (path: ':androidsdk-release', configuration: 'release')
implementation project (path: ':thermalsdk-release', configuration: 'release')
implementation 'org.jetbrains:annotations:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
这是我的 thermosdk-release.aar build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('src/main/java/app/skynavigator/common/skynavlib/xml/gson-2.5.jar')
}
两个模块的 build.gradle 是相同的。我对 Android Studio 和 Gradle 非常陌生。感谢任何花时间提供帮助的人。