简体   繁体   中英

Unexpected resource type 'dimen' expected: string

I updated to API 33 and now there is an error in the designer " unexpected resource type 'dimen' expected: string ". This error does not affect anything, but I would like to remove it.

This error appeared when I changed compileSdkVersion and targetSdkVersion in build.gradle from version 32 to version 33 . ( minSdkVersion uses version 24 ).

在此处输入图像描述

Resource file:

<resources>
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
</resources>
  1. For the sake of experimentation, I tried changing dimen to string and it worked, but obviously it shouldn't be that type as Android Studio requests localization for other languages.
  2. I also tried to lower the API version and it helped.
  3. Also, I decided to create a new text project based on API 33 and there was the same error there too.

Today there was an update for Android Studio and this bug has been fixed.

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