简体   繁体   中英

Internal Error occurred while analyzing this expression error in Android Studio Dolphin 2021.3.1

After updating Android Studio all lines that get resources like String, Drawbles,... show this error:

Internal Error occurred while analyzing this expression

What is wrong?

Solution 1:

You can try File -> Invalidate Caches .

Solution 2:

If this happened after update to Dolphin 2021.3.1 than better to upgrade Android Gradle Plugin . It can be done by click on Upgrade in message Project update recommended. Android Gradle Plugin can be upgraded. which can appear in right bottom corner after project opening. In Upgrade assistant window check the variant Upgrade and click Run selected steps . Also you can open assistant manually: Tools -> AGP Upgrade Assistant .

After migration finished also some of your libraries versions will be updated. For me the version of androidx.navigation:navigation-fragment-ktx changed to 2.4.1 .

The version of com.android.tools.build.gradle can be updated to 7.3.0 .

   dependencies {
      classpath 'com.android.tools.build:gradle:7.3.0'
   }

Gradle wrapper can be updated to version 7.4 .

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

I also manually updated the version of com.android.tools:desugar_jdk_libs to 1.1.5 because I was facing error Didn't find class "java.lang.Math8" on path: DexPathList while launching my apps.

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'

Update your android gradle plugin to version 7.3.0. It helped in my case, I had the same issue on 7.0.3 version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM