错误:没有找到匹配给定名称的资源(在“src”中,值为“@drawable/googleg_standard_color_18”)

时间:2022-11-21 12:29:39

First of, I've look through and tried various resource not found posts but still have not found a working fix for these errors that I'm not sure why are present, given that the last time I launched the app, it built fine.

首先,我查看并尝试了各种各样的资源,但还没有找到这些错误的工作方法,我不知道为什么会出现这些错误,因为上次我发布应用程序时,它就很好了。

错误:没有找到匹配给定名称的资源(在“src”中,值为“@drawable/googleg_standard_color_18”)

Error:(16, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_disabled_color_18').

错误:(16,30)没有找到匹配给定名称的资源(在“src”中,值为“@drawable/googleg_disabled_color_18”)。

Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').

错误:(9,30)没有找到匹配给定名称的资源(在“src”中,值为“@drawable/googleg_standard_color_18”)。

Here's what the gradle looks like

这是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"
    }
}

Any help or suggestions would be much appreciated! Thanks in advance!

非常感谢您的帮助或建议!提前谢谢!

More core to the issue is that I don't quite understand the problem here, so if anyone can point to where I can read more about this type of issues, I'd love to learn the reasoning behind the fixes.

更核心的问题是,我不太理解这里的问题,所以如果有人能指出我在哪里可以读到更多关于这类问题的内容,我很乐意了解修复的原因。

Cheers,

欢呼,

Edit: Adding Package.json file

编辑:添加包。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://git@github.com/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"
 }
}

2 个解决方案

#1


0  

generally this error happen when you don't have the SDK build tools with same version installed so you need to install buildToolsVersion '25.0.0' but based on your package.json dependencies you need to change your android/app/build.gradle to be like this

通常,当您没有安装相同版本的SDK构建工具时,您需要安装buildToolsVersion '25.0.0',但是基于您的包。您需要更改您的android/app/构建的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"
    }
}

and android/build.gradle to be like this

和android /构建。就像这样。

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'
   }
}

also it is not recommended to update react native android project throw android studio as it will case errors

也不建议更新react native android project throw android studio,因为它会出现错误。

#2


0  

So in the end, following @mohamed Kahlil's suggestion, I downgraded the build tool version back down to from 25 to 23.0.1. As well the compileSDK to 23 from 25. This however resulted in other dependencies errors between the google services.

最后,在@mohamed Kahlil的建议下,我将构建工具版本降级为25到23.0.1。以及从25到23的编译。但是,这导致了谷歌服务之间的其他依赖性错误。

First I forced all the google play services and firebase versions that I found were dependencies in the libraries I was using (fcm etc.) to 10.0.1 but it still produced conflicting errors. It was only until I found this medium post:

首先,我强制所有谷歌的游戏服务和firebase版本都是我所使用的库中的依赖项(fcm等)到10.0.1,但仍然产生了冲突的错误。直到我找到了这篇文章:

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

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

That suggested going through all the gradle settings, where I found that the conflicts were in play-services-maps, play-services-wallet, and play-services-identity (even though I didn't actually utilize this). Once I forced the compile versions of these three, the app built without any issues.

这意味着要经历所有的等级设置,在那里我发现冲突存在于游戏服务—地图、游戏服务—钱包和游戏服务—身份(尽管我实际上并没有使用它)。一旦我强制编译了这三个版本,这个应用程序就没有任何问题了。

So thank you Mohamed for helping me get back in the right direction!

所以,感谢*帮助我回到正确的方向!

Here's my sample code that I added

这是我添加的样本代码。

` 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;
     }`

#1


0  

generally this error happen when you don't have the SDK build tools with same version installed so you need to install buildToolsVersion '25.0.0' but based on your package.json dependencies you need to change your android/app/build.gradle to be like this

通常,当您没有安装相同版本的SDK构建工具时,您需要安装buildToolsVersion '25.0.0',但是基于您的包。您需要更改您的android/app/构建的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"
    }
}

and android/build.gradle to be like this

和android /构建。就像这样。

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'
   }
}

also it is not recommended to update react native android project throw android studio as it will case errors

也不建议更新react native android project throw android studio,因为它会出现错误。

#2


0  

So in the end, following @mohamed Kahlil's suggestion, I downgraded the build tool version back down to from 25 to 23.0.1. As well the compileSDK to 23 from 25. This however resulted in other dependencies errors between the google services.

最后,在@mohamed Kahlil的建议下,我将构建工具版本降级为25到23.0.1。以及从25到23的编译。但是,这导致了谷歌服务之间的其他依赖性错误。

First I forced all the google play services and firebase versions that I found were dependencies in the libraries I was using (fcm etc.) to 10.0.1 but it still produced conflicting errors. It was only until I found this medium post:

首先,我强制所有谷歌的游戏服务和firebase版本都是我所使用的库中的依赖项(fcm等)到10.0.1,但仍然产生了冲突的错误。直到我找到了这篇文章:

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

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

That suggested going through all the gradle settings, where I found that the conflicts were in play-services-maps, play-services-wallet, and play-services-identity (even though I didn't actually utilize this). Once I forced the compile versions of these three, the app built without any issues.

这意味着要经历所有的等级设置,在那里我发现冲突存在于游戏服务—地图、游戏服务—钱包和游戏服务—身份(尽管我实际上并没有使用它)。一旦我强制编译了这三个版本,这个应用程序就没有任何问题了。

So thank you Mohamed for helping me get back in the right direction!

所以,感谢*帮助我回到正确的方向!

Here's my sample code that I added

这是我添加的样本代码。

` 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;
     }`