Файл проекта не может быть построенAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Файл проекта не может быть построен

Сообщение Anonymous »

Я пытаюсь создать очень простой проект, чтобы понять тему Google Credential Manager в Android. Но когда я попытался запустить свой проект в эмуляторах (либо UpsideDownCake, либо Vanilla), приложение не запускается. и во время сборки выдает ошибку ->

Код: Выделить всё

5 issues were found when checking AAR metadata:
  1.  Dependency 'androidx.credentials: credentials- play- services- auth: 1. 5. 0- alpha04'  requires libraries and applications that       depend on it to compile against version 35 or later of the       Android APIs.
      :app is currently compiled against android-34.
      Also, the maximum recommended compile SDK version for Android Gradle       plugin 8.5.2 is 34.
      Recommended action: Update this project's version of the Android Gradle       plugin to one that supports 35, then update this project to use       compileSdk of at least 35.
      Note that updating a library or application's compileSdk (which       allows newer APIs to be used) can be done separately from updating       targetSdk (which opts the app in to new runtime behavior) and       minSdk (which determines which devices the app can be installed       on).
  2.  Dependency 'androidx.credentials: credentials: 1. 5. 0- alpha04'  requires libraries and applications that       depend on it to compile against version 35 or later of the       Android APIs.
      :app is currently compiled against android-34.
      Also, the maximum recommended compile SDK version for Android Gradle       plugin 8.5.2 is 34.
      Recommended action: Update this project's version of the Android Gradle       plugin to one that supports 35, then update this project to use       compileSdk of at least 35.
      Note that updating a library or application's compileSdk (which       allows newer APIs to be used) can be done separately from updating       targetSdk (which opts the app in to new runtime behavior) and       minSdk (which determines which devices the app can be installed       on).
  3.  Dependency 'androidx.biometric: biometric- ktx: 1. 4. 0- alpha02'  requires libraries and applications that       depend on it to compile against version 35 or later of the       Android APIs.
      :app is currently compiled against android-34.
      Also, the maximum recommended compile SDK version for Android Gradle       plugin 8.5.2 is 34.
      Recommended action: Update this project's version of the Android Gradle       plugin to one that supports 35, then update this project to use       compileSdk of at least 35.
      Note that updating a library or application's compileSdk (which       allows newer APIs to be used) can be done separately from updating       targetSdk (which opts the app in to new runtime behavior) and       minSdk (which determines which devices the app can be installed       on).
  4.  Dependency 'androidx.biometric: biometric: 1. 4. 0- alpha02'  requires libraries and applications that       depend on it to compile against version 35 or later of the       Android APIs.
      :app is currently compiled against android-34.
      Also, the maximum recommended compile SDK version for Android Gradle       plugin 8.5.2 is 34.
      Recommended action: Update this project's version of the Android Gradle       plugin to one that supports 35, then update this project to use       compileSdk of at least 35.
      Note that updating a library or application's compileSdk (which       allows newer APIs to be used) can be done separately from updating       targetSdk (which opts the app in to new runtime behavior) and       minSdk (which determines which devices the app can be installed       on).
  5.  Dependency 'androidx.core:core: 1. 15. 0- alpha01'  requires libraries and applications that       depend on it to compile against version 35 or later of the       Android APIs.
      :app is currently compiled against android-34.
      Also, the maximum recommended compile SDK version for Android Gradle       plugin 8.5.2 is 34.
      Recommended action: Update this project's version of the Android Gradle       plugin to one that supports 35, then update this project to use       compileSdk of at least 35.
      Note that updating a library or application's compileSdk (which       allows newer APIs to be used) can be done separately from updating       targetSdk (which opts the app in to new runtime behavior) and       minSdk (which determines which devices the app can be installed       on).
Я также пробовал использовать последние версии зависимостей, но это не работает. Я также попробовал перейти с Vanilla на UpsideDownCake для запуска в другой версии Android, это не работает.
Мои файлы кода: ->
  • libs.version .toml

Код: Выделить всё

[versions]
agp = "8.5.2"
kotlin = "2.0.10"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
lifecycleRuntimeKtx = "2.8.4"
activityCompose = "1.9.1"
composeBom = "2024.04.01"
navigationCompose = "2.8.0-beta06"
credentials = "1.5.0-alpha04"
kotlinSerialization = "1.6.3"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref="navigationCompose"}
androidx-credentials-core = { group = "androidx.credentials", name = "credentials", version.ref = "credentials" }
# Optional - needed for credentials support from play services, for Android 13 and below.
androidx-credentials-compat = { group = "androidx.credentials", name = "credentials-play-services-auth", version.ref = "credentials" }
# Added for non-deprecated LocalLifecycleOwner
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycleRuntimeKtx" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinSerialization" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
jetbrains-kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin"  }
  • Build.gradle(уровень проекта)

Код: Выделить всё

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.compose.compiler) apply false
}
  • Build.gradle(уровень приложения)

Код: Выделить всё

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.jetbrains.kotlin.serialization)
}

android {
namespace = "com.example.credentialmanagerdemo"
compileSdk = 34

defaultConfig {
applicationId = "com.example.credentialmanagerdemo"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {

implementation(libs.androidx.compose.navigation)
implementation(libs.androidx.credentials.core)
implementation(libs.androidx.credentials.compat)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.kotlinx.serialization.json)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
Если потребуются какие-либо дополнительные файлы, дайте мне знать. Я смиренно прошу вас помочь мне решить эту проблему.

Подробнее здесь: https://stackoverflow.com/questions/790 ... -get-build
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»