【发布时间】:2021-11-01 14:25:21
【问题描述】:
尝试在模拟器中构建我的应用程序后出现这样的错误
/Users/joel/.gradle/caches/transforms-3/06231cc1265260b25a06bafce7a4176f/transformed/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT:错误:找不到资源 android:attr/lStar。
我不知道是什么导致了这个错误。在挖掘了一些具有类似错误的答案(但在颤振中)Problem。但仍然没有解决我的问题。
我的项目中有这个依赖项
buildscript {
repositories {
google()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.firebase.crashlytics'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
maven { url "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod"}
mavenCentral()
}
android {
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "mobile.apps.my"
minSdkVersion 17
targetSdkVersion 29
multiDexEnabled true
versionCode 152
versionName "8.1.7"
vectorDrawables.useSupportLibrary = true // This line hereP
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
buildTypes {
debug {
firebaseCrashlytics {
mappingFileUploadEnabled false
}
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0-beta01', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.4.0-alpha03'
implementation "androidx.appcompat:appcompat-resources:1.4.0-alpha03"
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'it.sephiroth.android.library.imagezoom:imagezoom:2.3.0'
testImplementation 'org.json:json:20140107'
implementation 'com.comscore:android-analytics:6.1.0'
implementation 'com.android.support:customtabs:29.0.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.android.support:customtabs:29.0.0'
// Kodein Dependency Injection
implementation 'org.kodein.di:kodein-di-generic-jvm:6.2.1'
implementation 'org.kodein.di:kodein-di-framework-android-x:6.2.1'
// RETROFIT
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0' // for test String
// Room components
implementation "androidx.room:room-runtime:2.2.5"
kapt "androidx.room:room-compiler:2.2.5"
implementation "androidx.room:room-ktx:2.2.5"
androidTestImplementation "androidx.room:room-testing:2.2.5"
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'androidx.paging:paging-runtime:2.1.2'
// UI
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
implementation 'com.github.bluzwong:swipeback:0.2.0@aar'
implementation 'com.airbnb.android:lottie:3.6.0'
implementation 'com.veinhorn.scrollgalleryview:library:1.2.6'
implementation 'com.veinhorn.scrollgalleryview:picasso-loader:1.2.4'
implementation 'com.github.rubensousa:bottomsheetbuilder:1.6.1'
implementation "com.andkulikov:transitionseverywhere:1.8.1"
// HTTP LOGGING
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'androidx.multidex:multidex:2.0.1'
// ADS
implementation 'com.android.support:support-annotations:28.0.0'
// Required Dependency by Audience Network SDK
implementation 'com.google.android.gms:play-services-ads:19.7.0'
implementation 'com.google.android.gms:play-services-basement:17.6.0'
implementation("tv.teads.sdk.android:sdk:4.7.2@aar") {
transitive = true
}
implementation 'com.criteo.publisher:criteo-publisher-sdk:4.0.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.6.0'
implementation ('com.facebook.android:audience-network-sdk:5.5.0'){
exclude group: 'com.google.android.gms'
}
implementation 'com.google.firebase:firebase-crashlytics:17.4.0'
implementation "androidx.core:core-ktx:1.6.0" // I have update this based on other solution
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// COROUTINES
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
// Kotlin + coroutines
implementation "androidx.work:work-runtime-ktx:2.5.0"
implementation 'com.github.mumayank:AirLocation:1.3.1'
androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
implementation 'com.android.installreferrer:installreferrer:2.2'
//ANIMATION
implementation 'com.daimajia.androidanimations:library:2.4@aar'
implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.4'
implementation 'com.romandanylyk:pageindicatorview:1.0.3'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.0.Final'
//SOCIAL
implementation 'com.google.android.gms:play-services-auth:19.0.0'
}
我尝试升级androidx.core:core-ktx:1.6.0 的版本,然后同步或使缓存/重启无效。但他们都没有给我好的结果。我确信昨天我的项目没有问题,具有相同的依赖性。有人请帮助我,如果这个问题不清楚,让我添加更多信息。谢谢
【问题讨论】:
-
似乎您的至少一个依赖项已经在使用
lStar,这是一个自 API 级别 31 起新的系统属性,但您的构建工具只知道最高 29 的内容。简单地说将您的compileSdkVersion增加到 31 应该允许解析该属性。你能为这个项目做到这一点吗? -
这是由于核心androidx依赖的新
1.7.0-alpha02版本导致问题,只需切换到任何稳定版本,这个问题已经在这里发布了很多次了 -
Here 是这个依赖的所有版本列表,所以为了安全,你应该切换到稳定版本
-
@gtxtreme 这不是 [react-native] 问题。如果他们可以简单地更新其构建工具,则不建议降级任何东西。
-
@MikeM。是的,我只是要补充一点,如果你升级到
1.7.0-alpha02,那么你必须使用targetSdk 31,即Android 12,而这个问题只是谷歌为稳定的Android 12 版本做准备,每年都会发生类似的事情跨度>
标签: android kotlin android-gradle-plugin