最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Error after updating targetSdkVersion to 35 (Android 15): "resource compilation failed" and "cannot e

programmeradmin3浏览0评论

I recently updated the targetSdkVersion from 34 to 35 (Android 15 Beta) in my project, but I am encountering two issues after doing so:

1. Issue with targetSdkVersion Update:

I am receiving the following message in Android Studio:

It looks like you just edited the `targetSdkVersion` from 34 to 35 in the editor. Be sure to consult the documentation on the behaviors that change as a result of this. The Android SDK Upgrade Assistant can help with safely migrating.

I understand that changes in the targetSdkVersion might result in new behaviors, but I am unsure how to handle this warning. Does anyone have suggestions for safely migrating to API 35?

2. Resource Compilation Error:

After updating the SDK, I am also seeing the following error during compilation:

resource compilation failed (failed to compile values resource file. cause: java.lang.IllegalStateException: cannot extract resource from com.android.aaptcompiler.parsedresource@3b614346)

I also see a similar message with different resource IDs:

cannot extract resource from com.android.aaptcompiler.parsedresource@2b614346

My build.gradle.kts:

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.kotlinpose)
}

android {
    namespace = "com.example.thelema"
    compileSdk = 35  // Updated to API 35 (Android 15 Beta)

    defaultConfig {
        applicationId = "com.example.thelema"
        minSdk = 34
        targetSdk = 35
        versionCode = 1
        versionName = "1.0"
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = "11"
    }

    buildFeatures {
        compose = true
    }

    buildToolsVersion = "35.0.0"  // Ensuring the latest build tools are used
}

dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activitypose)
    implementation(platform(libs.androidxpose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)
    implementation(libs.androidx.appcompat)

    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidxpose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)

    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)

    implementation(libs.androidx.constraintlayout)
    implementation(libs.material)
    implementation(libs.androidx.work.runtime.ktx)
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论