cra*_*der 8 android gradle android-build android-resources android-studio
当我在我的PC上工作时,我有一个成功的构建项目,并且我已经提交并将其推送到我的Git仓库,然后再迁移到OSX.
现在,我在OSX上安装了Android studio最新版本并试图构建同一个项目,它在构建资源时出错.在Manifest中构建资源时,会出现多个错误
找不到与给定名称匹配的资源
对于drawables和字符串.
通过网络浏览,我想可能更新版本的gradle有一些问题.因此,我将AS的安装降级为AS 1.0并使用旧的gradle 2.2.不幸的是,这个版本的gradle也会出现同样的错误.
我build.gradle看起来如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "xxx"
minSdkVersion 16
targetSdkVersion 21
versionCode 4
versionName "1.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs = [
"/src/main/res"
]
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/thermodosdk-1.0.18.jar')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:support-v4:21.0.3'
Run Code Online (Sandbox Code Playgroud)
将build.gradle在顶层有以下类路径:
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugTestSources]
:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6587Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
/Users/vidhigoel/AndroidStudioProjects/OMGAndroid/app/build/intermediates/manifests/full/debug/AndroidManifest.xml
Error:(24, 23) No resource found that matches the given name (at 'icon' with value '@drawable/omg_app_icon').
Error:(25, 24) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(27, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(30, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(86, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(105, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(123, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(137, 28) No resource found that matches the given name (at 'label' with value '@string/title_activity_register_user').
...
Information:BUILD FAILED
Information:Total time: 4.462 secs
Information:17 errors
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.
您实际上并不需要这部分build.gradle:
sourceSets {
main {
res.srcDirs = [
"/src/main/res"
]
}
}
Run Code Online (Sandbox Code Playgroud)
你可能只想说:
res.srcDirs = ['res']
Run Code Online (Sandbox Code Playgroud)
sourceSets从 中删除该部分build.gradle。删除上述配置后进行清理并重建。为了更安全,还可以做File - > Invalidate Cache and Restart
| 归档时间: |
|
| 查看次数: |
1130 次 |
| 最近记录: |