styles.xml에서 'Theme'기호를 확인할 수 없습니다 (Android Studio)
오늘부터 Android Studio는 styles.xml에서 AppCompat 테마를 찾을 수 없지만 예를 들어 코드의 AppCompatActivity는 인식됩니다. 내 Android Studio 버전은 2.2.2, 빌드 # AI-145.3360264입니다.
이미 최신 빌드 도구로 업그레이드하고 SDK (25) 버전 등을 컴파일하려고 시도했지만 문제가 해결되지 않았습니다.
현재 SDK 관리자에서 다음을 설치했습니다.
- 안드로이드 API : 19와 23
- SDK 플랫폼 도구 : 25.0.1
- SDK 도구 : 25.2.3
- 빌드 도구 : 23.0.2 및 25.0.1
- 지원 저장소 : 40
- 구글 저장소 : 39
그리고 여기에 나열 할 필요가없는 다른 몇 가지가 있습니다.
앱의 build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.1'
defaultConfig {
applicationId "xxx.xxxxxxxx.xxxxxxxxx" //not the real applicationId
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/RootTools.jar')
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:support-v13:23.+'
compile 'com.android.support:appcompat-v7:23.+'
compile 'com.android.support:design:23.+'
compile 'com.android.support:cardview-v7:23.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
Android Studio 3.1.2에서 나를 위해 일한 다른 솔루션 :
다음이 build.gradle
있으면 삭제하십시오 .
'com.android.support:appcompat-v7:27.1.1' 'com.android.support:design:27.1.1'
동기화 한 다음 삭제를 취소 한 다음 다시 동기화하십시오.
I encountered this after updating to Android Studio 3.1.
None of the other answers listed here worked for me, however when I switched my appcompat support lib version to the latest 28.0.0-alpha1
then back to 27.1.0
that it was on before, it worked.
Seems the new version of Android Studio lost connection to where the library was synced to and just needed to have it reset.
No need to change anything.
Just press small button on top "Sync Project with Gradle Files"
EDIT: As @Alexey noted, bug still appears in Android Studio v3.1.4
This worked for me:
- Click File > Close Project
- Reopen the project from Studio's dialog.
That's because of feature called "build cache" that is enabled by default in build Android Plugin since 2.3.0. It creates files in build cache outside of project folder (in my case -- in \Users\%username%\.android\build-cache) Theese files are intended to be common between your projects.
And then Android Studio is unable to navigate in theese files. That's all.
If you want to disable Build Cache, add android.enableBuildCache=false
to gradle.properties
file. Then restart Android Studio.
more info here: https://developer.android.com/studio/build/build-cache.html#disable_build_cache
I have had the same problem. The only solution that worked for me was to manually delete the support libraries in file system and sync the project to let Android Studio download them again.
Steps:
- Go to your project folder in File system
- Go to
.idea\libraries
- Delete all the
Gradle__com_android_support_****.xml
files - Open Android Studio
- Select
File > Sync with File System
- Once that is done, Select
File > Sync Project with Gradle Files
Build Project
And now your error should be gone!!!
you can hit file -> invalidate Caches / Restart ... if it doesn't fix the issue you can close the project (file-> close project) and import it (file -> new -> import project.
I switched support lib to version 27.1.1 and problem has been solved. Seems like some bug in 27.1.0
I went through the same problem when I upgraded to alpha-2.
I looked at this link: http://tools.android.com/recent, but the only thing that worked well was:
Change this: Classpath 'com.android.tools.build:gradle:2.3.0-alpha2'
For this: Classpath 'com.android.tools.build:gradle:2.2.3'
In your build.gradle (Project)
Only this worked for me
- Close project (File> Close Project)
- Import / Re-Open project again (NOT from Recent)
Error should be resolved now.
If that fails, try below-
- Open build.gradle, remove
appcompact-v7
dependency and sync project. - Add
appcompact-v7
dependency and sync.
I encountered same problem like this.Just the difference is I was using Studio 2.2.3. This is what solved my problem:
In my project level gradle I had:
classpath 'com.android.tools.build:gradle:2.3.0-alpha2' (which was a result of updating studio)
which I replaced with: classpath 'com.android.tools.build:gradle:2.2.3'
I think you should look for a compatible classpath for your gradle configuration.
In newer versions of Android Studio, we are asked to use 'AppCompat'. Some users uncheck that and still use the Theme.AppCompat
. That makes up this error. Same happened with me.
Solution is to add this line in your build.gradle (app).
compile 'com.android.support:appcompat-v7:26.1.0'
I was having the same issue after linking Firebase to my app. Updating the build.gradle in the app module did the trick, updated to:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
I had also the same problem when I upgraded my android studio from 2.2.2 to 2.3 Canary Version. Although the new beta version of 2.3 is released yet it is using the gradle plugin of 2.2.3 which is of stable version.
So just change the classpath dependency in buildscript of build.gradle project level from alpha to 2.2.3 and sync it. It'll resolve the issue or change to the more appropriate version with respect to your channel version.
More on gradle watch this Gradle Recipes for android Ken Kousen - Gradle Summit 2016
https://www.youtube.com/watch?v=4L6wHTVmxGA
@Daniel Wilson made a comment in one of the answers that solved this issue for me. I wanted to add add as an answer to draw more attention to this solution.
Updating compileSdkVersion
and targetSdkVersion
from 26 to 27 (and then of course updating the dependencies) eliminated the errors for me.
Mine was fixed by deleting the .gradle file from the folder and re-importing the project in Android Studio
I also faced the problem with Android Studio 3.1 , syncing does not help me.
Then I switched back to
`'com.android.support:design:27.1.0'` from : `'com.android.support:design:27.1.1'`
and added android.enableBuildCache=false
to gradle.properties
to disable build cache
This is weird, I encounter this problem as below:
- Android Studio is 3.1.2
- support lib version is 27.0.0
I solve this by below:
- change support lib version to 27.1.0, and "Sync Project with Gradle Files", then this error disappear
- change support lib version to 27.0.0,and "Sync Project with Gradle Files", then this error not appear again
Deleted .idea and .gradle from project folder. Then sync with gradle files, it worked.
Android Studio 소프트웨어를 업데이트 할 때도 같은 문제가 발생했습니다. 내가 한 일은 다음과 같습니다.
다음과 같이 Gradle 설정으로 이동하십시오 (이 경로는 Mac 용이지만 Windows에서는 비슷해야 함).
Android Studio-> 환경 설정-> 빌드, 실행, 배포-> Gradle.
그런 다음 "기본 gradle 래퍼 사용 (권장)"을 선택하십시오.
해당 옵션을 이미 선택한 경우 문제가 다른 곳에 있어야합니다.
내 gradle 버전을
classpath 'com.android.tools.build:gradle:2.3.0'
에
classpath 'com.android.tools.build:gradle:2.2.3'
그리고 지금 작동합니다!
Android Studio 3.1.3에서 간단한 해결 방법은 다음과 같습니다.
"그라들 파일과 프로젝트 동기화"
'Programming' 카테고리의 다른 글
자바에서 소수점 이하 2 자리까지 반올림? (0) | 2020.05.21 |
---|---|
테이블의 기본 데이터 정렬을 변경하는 방법은 무엇입니까? (0) | 2020.05.21 |
활동하지 않는 장소에서 getLayoutInflater ()를 호출 (0) | 2020.05.21 |
HTML은 프로그래밍 언어로 간주됩니까? (0) | 2020.05.21 |
가운데 점에 대한 HTML 엔터티 (0) | 2020.05.21 |