Fis*_*yLP 175 android android-appcompat gradle android-studio android-styles
从今天开始,Android Studio无法在styles.xml中找到AppCompat主题,但是例如代码中的AppCompatActivity确实得到了识别.我的Android Studio版本是2.2.2,Build#AI-145.3360264
我已经尝试升级到最新的构建工具,编译sdk(25)版本等,但它没有解决问题.
目前我安装了以下内容(来自sdk经理):
和其他一些,这里没有必要列出.
app的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'
}
Run Code Online (Sandbox Code Playgroud)
M D*_*D P 217
另一个适用于Android Studio 3.1.2的解决方案:
build.gradle
如果你有这些删除它们:
'com.android.support:appcompat-v7:27.1.1'
'com.android.support:design:27.1.1'
然后同步,然后撤消删除,然后再次同步.
kas*_*sim 105
我在更新到Android Studio 3.1后遇到了这个问题.
这里列出的其他答案都没有为我工作,但是当我将我的appcompat支持lib版本更改为最新版本28.0.0-alpha1
然后回到27.1.0
它之前的版本时,它工作正常.
似乎新版本的Android Studio丢失了与库同步到的位置的连接,只是需要重置它.
Vad*_*dim 91
无需改变任何东西.
只需按下"使用Gradle文件同步项目"顶部的小按钮
bab*_*bay 37
这是因为自2.3.0以来在构建Android插件中默认启用了称为"构建缓存"的功能.它在项目文件夹之外的构建缓存中创建文件(在我的情况下 - 在\ Users \%username%\ .android\build-cache中)Theese文件在您的项目之间是通用的.
然后Android Studio无法在theese文件中导航.就这样.
如果要禁用Build Cache,请添加android.enableBuildCache=false
到 gradle.properties
文件.然后重启Android Studio.
更多信息:https: //developer.android.com/studio/build/build-cache.html#disable_build_cache
Tri*_*Bay 27
我曾经也有过一样的问题.对我有用的唯一解决方案是手动删除文件系统中的支持库并同步项目以让Android Studio再次下载它们.
脚步:
.idea\libraries
Gradle__com_android_support_****.xml
文件File > Sync with File System
File > Sync Project with Gradle Files
Build Project
现在你的错误应该消失了!
Ser*_*nko 12
我将支持lib切换到版本27.1.1并且问题已经解决.看起来像27.1.0中的一些错误
小智 10
当我升级到alpha-2时,我遇到了同样的问题.
我查看了这个链接:http://tools.android.com/recent,但唯一运作良好的是:
改变这个:Classpath'com.android.tools.build:grad: 2.3.0-alpha2'
为此:Classpath'com.android.tools.build:grad: 2.2.3'
在build.gradle(Project)中
小智 3
我遇到了同样的问题。只是不同的是我使用的是 Studio 2.2.3。这就是解决我的问题的方法:
在我的项目级别 gradle 中,我有:
类路径 'com.android.tools.build:gradle:2.3.0-alpha2' (这是更新 studio 的结果)
我将其替换为:classpath 'com.android.tools.build:gradle:2.2.3'
我认为你应该为你的 gradle 配置寻找兼容的类路径。
归档时间: |
|
查看次数: |
65823 次 |
最近记录: |