Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: No resource found powered_by_google_light icon in build tools 23.0.3?

I have always used the powered_by_google icons as I'm using the Google Places API. They look like this:

enter image description here

On this site, it says the icons are included within the Google Play services library: https://developers.google.com/places/android-api/attributions

The 'Powered by Google' image is included in the Google Play services library, in the correct sizes for Android apps. You may not resize or modify these images in any way:

For use on a light background: @drawable/powered_by_google_light For use on a dark background: @drawable/powered_by_google_dark

Now, previously, I would just reference the icons in my xml by doing this:

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/powered_by_google_inner"
                android:src="@drawable/powered_by_google_light"
                android:padding="8dp"/>

Now after upgrading my Google Play Services library from 8.4 to 9.2.1, the drawable is no longer found in my libraries and I get this error when I try to build my app:

Error:(14, 22) No resource found that matches the given name (at 'src' with value '@drawable/powered_by_google_light'). Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/Library/Android/sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1

This is my app.gradle (an extract):

apply plugin: 'com.android.application'

android {

    compileSdkVersion 23
    buildToolsVersion '23.0.3'


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.google.android.gms:play-services-base:9.2.1') {
        exclude module: 'support-v4'
    }
    compile('com.google.android.gms:play-services-location:9.2.1') {
        exclude module: 'support-v4'
    }
    compile('com.google.android.gms:play-services-gcm:9.2.1') {
        exclude module: 'support-v4'
    }
    compile('com.google.android.gms:play-services-maps:9.2.1') {
        exclude module: 'support-v4'
    }
    compile('com.google.android.gms:play-services-appinvite:9.2.1') {
        exclude module: 'support-v4'
    }
    compile('com.google.android.gms:play-services-analytics:9.2.1') {
        exclude module: 'support-v4'
    }
}
apply plugin: 'com.google.gms.google-services'

This is my main gradle file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

For now, I'm using a workaround in that I'm downloading the icons from here: https://developers.google.com/places/web-service/policies and incorporating them into my apps drawable folders.

like image 737
Simon Avatar asked Dec 24 '22 03:12

Simon


1 Answers

Some places functionality moved into its own library in v9.2. You need to add com.google.android.gms:play-services-places:9.2.1 to your gradle file.

like image 162
AndrewR Avatar answered Dec 30 '22 12:12

AndrewR