1

enter image description here

I have an error in the following code:

{
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:recyclerview-v7:22.0.0'
    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
}

Screenshot https://i.stack.imgur.com/7gkOM.png The error is:

Gradle 2.2.0 is using

What could be the problem?

Error log:

Information:Gradle tasks [:Avasarangal:generateDebugSources, :Avasarangal:mockableAndroidJar, :Avasarangal:prepareDebugUnitTestDependencies, :Avasarangal:generateDebugAndroidTestSources]
E:\MY ANDROID SOURSE CODE\railway\orginal\Avasarangal\src\main\res\menu\menu_search.xml
Error:(7, 23) No resource found that matches the given name (at 'icon' with value '@drawable/abc_ic_search_api_mtrl_alpha').
E:\MY ANDROID SOURSE CODE\railway\orginal\Avasarangal\src\main\res\menu\search.xml
Error:(7, 23) No resource found that matches the given name (at 'icon' with value '@drawable/abc_ic_search_api_mtrl_alpha').
E:\MY ANDROID SOURSE CODE\railway\orginal\Avasarangal\build\intermediates\res\merged\debug\menu\menu_search.xml
Error:(7, 23) No resource found that matches the given name (at 'icon' with value '@drawable/abc_ic_search_api_mtrl_alpha').
E:\MY ANDROID SOURSE CODE\railway\orginal\Avasarangal\build\intermediates\res\merged\debug\menu\search.xml
Error:(7, 23) No resource found that matches the given name (at 'icon' with value '@drawable/abc_ic_search_api_mtrl_alpha').
Error:Execution failed for task ':Avasarangal:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Information:BUILD FAILED
Information:Total time: 1 mins 59.967 secs
Information:5 errors
Information:0 warnings
Information:See complete output in console
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96

2 Answers2

0

You need to upgrade your compileSdkVersion, BuildToolsVersion, targetSdkVersion, and support library to use the more recent version. You can try using version 26. You should not use Google Play Service version >= 9.0 with support library <= 24 because there is compatibility issue (more at https://stackoverflow.com/a/46616652/4758255)

android {

  compileSdkVersion 26
  buildToolsVersion 26.0.2

  defaultConfig {
    minSdkVersion 16
    targetSdkVersion 26
  }
  ...
}

dependencies {
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
}
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
0

this problem will appear when try to compile lib version that not compatible with the compileSdkVersion ,your problem will solve if you add the google repository .

open bulid.gradle in main project folder and add the following code in allprojects {

repositories {
        jcenter()
        google()
    }
}

I try to using this and solve my problem

Kosh
  • 6,140
  • 3
  • 36
  • 67