错误:找不到与给定名称匹配的资源(在'src'中,值为'@ drawable/googleg_standard_color_18')

问题描述:

首先,我仔细查看并尝试了各种找不到资源的帖子,但仍未找到工作修正对于这些我不确定为什么会出现的错误,考虑到上次启动应用程序时,它的构建正常。错误:找不到与给定名称匹配的资源(在'src'中,值为'@ drawable/googleg_standard_color_18')

enter image description here

错误:(16,30)没有资源发现在给定的名字相匹配(在 'SRC',值为 '@绘制/ googleg_disabled_color_18')。

错误:(9,30)找不到与给定名称匹配的资源(位于'src',值为'@ drawable/googleg_standard_color_18')。

这里的gradle这个样子

android { 
compileSdkVersion 25 
buildToolsVersion '25.0.0' 

defaultConfig { 
    applicationId "com.moveapps" 
    minSdkVersion 16 
    targetSdkVersion 23 
    multiDexEnabled true 
    versionCode 1 
    versionName "1.1.0" 
    ndk { 
     abiFilters "armeabi-v7a", "x86" 
    } 
} 

任何帮助或建议,将不胜感激!提前致谢!

这个问题的更多核心是我不太了解这里的问题,所以如果任何人都可以指出我可以在哪里阅读更多关于这类问题的信息,我很乐意学习修复背后的原因。

干杯,

编辑:添加的package.json文件

{ 
    "name": "moveapp", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
"test": "jest" 
}, 
"dependencies": { 
"async": "^2.4.0", 
"firebase": "^3.9.0", 
"images": "^3.0.0", 
"lodash": "^4.17.4", 
"moment": "^2.18.1", 
"react": "15.4.1", 
"react-native": "^0.41.2", 
"react-native-app-intro": "^1.1.5", 
"react-native-apple-healthkit-rn0.40": "^0.2.1-2", 
"react-native-chart": "git+https://[email protected]/robcalcroft/react-native-chart.git", 
"react-native-communications": "^2.2.1", 
"react-native-confetti": "0.0.4", 
"react-native-fbsdk": "^0.5.0", 
"react-native-fcm": "^6.2.3", 
"react-native-firestack": "^2.3.9", 
"react-native-google-fit": "^0.2.0", 
"react-native-modal-picker": "0.0.16", 
"react-native-progress": "^3.2.0", 
"react-native-router-flux": "3.37.0", 
"react-native-scrollable-tab-view": "^0.7.2", 
"react-native-search-bar": "^3.0.0", 
"react-native-searchbar": "^1.10.0", 
"react-native-vector-icons": "^4.1.1", 
"react-redux": "^5.0.2", 
"redux": "^3.6.0", 
"redux-persist": "^4.7.1", 
"redux-thunk": "^2.2.0", 
"tipsi-stripe": "^3.7.0", 
"uuid": "^3.0.1" 
    }, 
"devDependencies": { 
"babel-jest": "18.0.0", 
"babel-preset-react-native": "1.9.1", 
"eslint-config-rallycoding": "^3.2.0", 
"jest": "18.1.0", 
"react-test-renderer": "15.4.1" 
    }, 
"jest": { 
"preset": "react-native" 
} 
} 
+0

难道这些图像或颜色您设置我的示例代码? – NeoVe

+0

看起来像这些已经改变,或已被删除,但它只是一个猜测 – NeoVe

+0

添加你的package.json请 –

通常这个错误发生在你没有SDK构建具有相同版本的工具安装,所以你需要安装buildToolsVersion '25 0.0 0.0' ,但根据您的package.json的依赖,你需要改变你的​​是这样

android { 

    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    defaultConfig { 
    applicationId "com.moveapps" 
    minSdkVersion 16 
    targetSdkVersion 22 
    multiDexEnabled true 
    versionCode 1 
    versionName "1.1.0" 
    ndk { 
     abiFilters "armeabi-v7a", "x86" 
    } 
} 

android/build.gradle是这样

buildscript { 

    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' // this is the correct version for build tool 

    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
    //  classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 
    } 
} 

也是不建议更新反应原生的Android项目投Android的工作室,因为它会区分错误到底

+0

感谢Mohamed,我试过以前的版本,并且Gradle无法同步为错误信息:Error:SDK Build Tools revision(23.0.1)is项目':app'太低。最低要求是25.0.0 Update Build Tools version and sync project
Open File xclearner

+0

所以我降级到你建议的设置,然后gradle以及2.2.3。这样做似乎暗示我的Google服务依赖关系可能存在一些冲突,所以我要调查一下......谢谢! – xclearner

+0

看到这个更新 –

所以,下面@mohamed卡希尔的建议下,我降级构建工具版本从25降低到23.0.1。以及从25编译SDK到23。然而这导致了谷歌服务之间的其他依赖关系错误。

首先,我强制所有的谷歌播放服务和firebase版本,我发现它们是依赖于我使用的库(fcm等)到10.0.1,但它仍然产生了冲突错误。这是唯一的,直到我发现这个介质后:

https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f

这表明通过所有的gradle这个设置,在那里我发现,冲突是在播放服务地图,发挥服务钱包,并发挥去 - 服务 - 身份(即使我没有真正使用这个)。一旦我强制这三个版本的编译,应用程序没有任何问题。

所以,谢谢*帮助我恢复正确的方向!

下面是我添加

` android { 
    - compileSdkVersion 25 
    - buildToolsVersion '25.0.0' 
    + compileSdkVersion 23 
    + buildToolsVersion '23.0.1' 

    defaultConfig { 
     applicationId "com.moveapps" 
     minSdkVersion 16 
    -  targetSdkVersion 23 
    +  targetSdkVersion 22 
     multiDexEnabled true 
     versionCode 1 
     versionName "1.1.0" 
    @@ -149,20 +149,70 @@ repositories { 

    dependencies { 
    compile project(':tipsi-stripe') 
- compile project(':react-native-google-fit') 
    compile project(':react-native-fbsdk') 
- compile project(':react-native-fcm') 
- compile project(':react-native-firestack') 
+ 
+ compile(project(':react-native-google-fit')){ 
+  exclude group: 'com.google.android.gms', module: 'play-services-auth' 
+  exclude group: 'com.google.android.gms', module: 'play-services-fitness' 
+ } 
+ 
+ compile(project(':react-native-fcm')){ 
+  exclude group: 'com.google.firebase', module: 'firebase-messaging' 
+  exclude group: 'com.google.firebase', module: 'firebase-core' 
+ } 
+ 
+ compile(project(':react-native-firestack')){ 
+  exclude group: 'com.google.firebase', module: 'firebase-messaging' 
+  exclude group: 'com.google.firebase', module: 'firebase-core' 
+  exclude group: 'com.google.firebase', module: 'firebase-auth' 
+  exclude group: 'com.google.firebase', module: 'firebase-analytics' 
+  exclude group: 'com.google.firebase', module: 'firebase-storage' 
+ 
+  exclude group: 'com.google.android.gms', module: 'play-services-base' 
+  exclude group: 'com.google.android.gms', module: 'play-services-gcm' 
+ } 
+ 
+ compile('com.google.android.gms:play-services-auth:10.0.1') { 
+  force = true; 
+ } 
+ compile('com.google.android.gms:play-services-fitness:10.0.1') { 
+  force = true; 
+ } 
+ 
+ compile('com.google.android.gms:play-services-base:10.0.1') { 
+  force = true; 
+ } 
+ 
+ compile('com.google.android.gms:play-services-gcm:10.0.1') { 
+  force = true; 
+ } 
+ 
+ compile('com.google.android.gms:play-services-identity:10.0.1') { 
+  force = true; 
+ } 
+ 
+ compile('com.google.android.gms:play-services-maps:10.0.1') { 
+  force = true; 
+ } 
+ 
+ compile('com.google.android.gms:play-services-wallet:10.0.1') { 
+  force = true; 
+ } 
+ 
    compile('com.google.firebase:firebase-core:10.0.1') { 
     force = true; 
    } 
    compile('com.google.firebase:firebase-messaging:10.0.1') { 
     force = true; 
    } 
- compile('com.google.android.gms:play-services-gcm:10.0.1') { 
+ 
+ compile('com.google.firebase:firebase-auth:10.0.1') { 
     force = true; 
    } 
- compile('com.google.android.gms:play-services-base:10.0.1') { 
+ compile('com.google.firebase:firebase-analytics:10.0.1') { 
+  force = true; 
+ } 
+ compile('com.google.firebase:firebase-storage:10.0.1') { 
     force = true; 
    }`