gradle 将compileSdk和targetSdk更改为33后未获取Xml建议

zpqajqem  于 2022-11-14  发布在  其他
关注(0)|答案(2)|浏览(648)

我在将compilesdk和targetsdk更新为33时遇到了一些问题。
而如果我将compilesdk或targetsdk设置为32、31或更少,我会在编译过程中遇到另一个库支持问题,如下所述...

1.  Dependency 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02' requires libraries and applications that
  depend on it to compile against version 33 or later of the
  Android APIs.

  :app is currently compiled against android-32.

  Also, the maximum recommended compile SDK version for Android Gradle
  plugin 7.2.1 is 32.

  Recommended action: Update this project's version of the Android Gradle
  plugin to one that supports 33, then update this project to use
  compileSdkVerion of at least 33.

  Note that updating a library or application's compileSdkVersion (which
  allows newer APIs to be used) can be done separately from updating
  targetSdkVersion (which opts the app in to new runtime behavior) and
  minSdkVersion (which determines which devices the app can be installed
  on).

所有新添加到Gradle的库都出现了同样的问题
我不确定这是sdk 33还是库的问题。
我已经试过了---〉https://stackoverflow.com/questions/30684613/android-studio-xml-editor-autocomplete-not-working-with-support-libraries/54007742#54007742

ahy6op9u

ahy6op9u1#

请参考此link。Android Studio花栗鼠版本中存在问题。Google团队在Android Studio海豚中修复了此问题。请同时检查Issue Tracker

soat7uwm

soat7uwm2#

替换

def lifecycle_version = "2.6.0-alpha02"

def lifecycle_version = "2.4.0-rc01"

build.gradle(app)文件中。
屏幕截图请参见this link

相关问题