Programming

buildToolsVersion '26 .0.2 '에 대해 Android Studio를 2.3에서 3.0으로 업데이트 한 후'? attr / actionBarSize '기호를 확인할 수 없습니다.

procodes 2020. 7. 13. 22:03
반응형

buildToolsVersion '26 .0.2 '에 대해 Android Studio를 2.3에서 3.0으로 업데이트 한 후'? attr / actionBarSize '기호를 확인할 수 없습니다.


Android Studio를 2.3에서 3.0으로 업데이트 한 후 buildToolsVersion26.0.0에서 26.0.2로 변경 된 후이 오류가 발생합니다.

Cannot resolve symbol '?attr/actionBarSize

Xml 코드 :

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="@color/colorPrimary"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:titleTextColor="@android:color/white"/>

종속성 :

compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'

아무것도 도움이되지 않지만 변화 :

?attr/actionBarSize에이 ?android:attr/actionBarSize작업을했다.

실제로 몇 가지 버전의 버그입니다. 수정하지 않아도 Android는 런타임에 자동으로 수정합니다.


모든 라이브러리 버전을 26.1.0최신 버전으로 업데이트하고 다음 을 추가하십시오.

compile 'com.android.support:support-v4:26.1.0'

Android Studio 3.0.0 이상을 사용하는 경우

implementation 'com.android.support:support-v4:26.1.0'

프로젝트를 동기화하면 라이브러리의 ?attr/actionBarSize일부 이므로 오류가 자동으로 해결됩니다 v4.


프로젝트 디렉토리 계층에서 "Android"를 "Project"로 전환하십시오. 그런 다음 ". 라이브러리"폴더 만 ".idea / libraries"를 삭제하십시오. "파일-> 캐시 무효화 / 재시작 ...-> 무효화 및 재시작"메뉴에서 옵션을 선택하십시오.


좋은 날, 나는 이것이 조금 늦다는 것을 안다.

하지만 Android Studio 3.0으로 업데이트 할 때이 문제가 발생했습니다.

내가 한 일은 내가 바뀌 었어

compile 'com.android.support:support-v4:26.1.0'

implementation 'com.android.support:support-v4:26.1.0'

누군가를 도울 수 있기를 바랍니다.


이것이 바로 똑같은 문제를 해결하기 위해했던 것입니다. 1. SDK 관리자로 이동하십시오. 2. Android API 27 및 Android 8.0 (Oreo)을 확인하십시오. 3. "적용"을 클릭하여 해당 SDK를 다운로드하여 설치하십시오. 4. build.gradle에서 'buildToolsVersion "26.0.1"'을 'buildToolsVersion "26.0.2"'로 변경하십시오. gradle sync를 수행하십시오.

이것이 문제를 해결하는 데 도움이되기를 바랍니다.


buildToolsVersion 버전이 종속 버전과 다릅니다 (예 : buildToolsVersion은 27.0.0이지만 구현 'com.android.support:support-v4:27.0.1'). 그것들을 동일하게 만드십시오.


내 문제는 변경하여 해결 compileSdkVersiontargetSdkVersion에서 26마지막 버전으로 27, 또한 u는 UR 업그레이드 할 필요 dependencies27.

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com......"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
}

이것이 당신의 문제를 해결하기를 바랍니다 :)


build.gradle (app) 의존성에 이것을 추가하십시오 :

resolutionStrategy {
    force libraries.support.appCompat
    force libraries.support.design
    force 'com.android.support:support-utils:26.0.1'
    force 'com.android.support:support-compat:26.0.1'
}

이것은 효과가 있었다.

컴파일을 지원하고 lib 버전을 26.xx에서 27.xx로 지원합니다.


I tried all the answers here and so many others from lots of places but only the below techniques worked for me. The simple way is you just need to close the project then import the same project as a Gradle project Or you can go to Project structure -> project -> change Gradel plugin = 4.4 and Android plugin version = 3.1.4. Both of these above methods work.

Note: These versions(4.4, 3.1.4) are latest when I write this answer please use the latest version instead of these.


Maybe you hava upgraded the version of gradle. when my gradle version is 4.4 and plugin version is 3.1.1.It is ok.

enter image description here


this work:

delete all file in $HOME/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar


Changed all Support Library versions to the newest 27.1.1 and the error was gone.


please replace android support libraries.

from

27.1.1

to

28.0.0-alpha3

and replace 27 to 28 for following cases:

compileSdkVersion 28
buildToolsVersion "28.0.0"
targetSdkVersion 28

this will fix the issue.

참고URL : https://stackoverflow.com/questions/47026492/cannot-resolve-symbol-attr-actionbarsize-after-updating-android-studio-from-2

반응형