我之前问过一个关于我的项目的问题,仍然需要帮助。
安卓工作室 3 分级同步问题
现在我有另一个我无法弄清楚的问题。 当我尝试构建我的项目时,出现此错误:
错误:无法解决: :sdk 版本:
我的 sdk-release.aar 文件在 projectFolder>libs>aar 和 sdk-release 文件夹中
该错误是什么,我该如何解决?
我的build.gradle代码现在是这样的
buildscript {
repositories {
mavenCentral()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.kofax.sdk.samples.easysnap'
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName '1.0'
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
buildTypes {
release
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
lintOptions {
abortOnError false
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
def sdkRef
project.getRootProject().allprojects.each { proj ->
if (proj.name.toLowerCase().equals('sdk')) {
sdkRef = proj;
return true;
}
}
if (sdkRef) {
println "SDK present in project; using project reference as dependency"
compile sdkRef
} else {
println "SDK is not present in project; dependency reference"
repositories {
flatDir { dirs 'libs' }
}
implementation (name: 'sdk-release', ext: 'aar')
}
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:23.4.0'
}
更改代码:
implementation (name: 'sdk-release', ext: 'aar')
compile fileTree(dir: 'libs', include: ['*.jar'])
自
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.aar'])
或
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])