【发布时间】:2020-04-30 19:18:46
【问题描述】:
在构建项目时出现此错误
没有 com.android.tools.build:aapt2:3.5.2-5435860 的缓存版本 可用于离线模式。
这是我的 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
// android.enforceUniquePackageName = false
defaultConfig {
applicationId "com.miride"
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
versionCode 71
versionName "5.1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
// signingConfig signingConfigs.release
}
}
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
annotationProcessor files('libs/pubnub-gson-4.19.0-all.jar')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.stripe:stripe-android:7.1.0'
implementation 'com.urbanairship.android:urbanairship-fcm:9.1.0'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.2.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'io.card:android-sdk:5.5.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'org.droidparts:droidparts:2.9.8'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'se.emilsjolander:stickylistheaders:2.7.0'
implementation 'ch.acra:acra:4.9.0'
implementation 'com.wefika:flowlayout:0.4.1'
implementation 'org.jsoup:jsoup:1.11.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
implementation files('libs/mpointsdk.aar')
implementation files('libs/basesdk.aar')
implementation files('libs/mProfileSDK.aar')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
apply plugin: 'com.google.gms.google-services'
我已经尝试了所有可能的解决方案,但无法摆脱这个错误。如果有人有任何解决方案或建议,请发布。
【问题讨论】:
-
是的,我已经试过了,我的 gradle 版本是 3.5.2
-
在此链接中使用 188 票来检查答案:stackoverflow.com/questions/22607661/…
-
Gradle 处于离线模式:转到 Preferences > Gradle 并取消选中“Offline work”。