Android:在build tools 23.0.3中找不到资源powered_by_google_light图标? [英] Android: No resource found powered_by_google_light icon in build tools 23.0.3?

查看:201
本文介绍了Android:在build tools 23.0.3中找不到资源powered_by_google_light图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 Google Places API 时,我总是使用 Powered_by_google 图标。他们看起来像这样:





在这个网站它表示图标包含在Google Play服务库中: https://开发人员。 google.com/places/android-api/attributions


Google支持图片包含在Google Play中为Android应用程序提供正确尺寸的服务
库。您可能无法调整或
以任何方式修改这些图片:

在浅色背景上使用:@ drawable / Powered_by_google_light对于
,使用黑暗的背景:@ drawable / powered_by_google_dark

现在,我以前只需在xml中引用图标:

 < 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/>

现在将我的Google Play服务库从8.4升级到9.2.1后,不再找到绘图在我的库中,当我尝试构建应用程序时,出现此错误:
$ b blockquote>

错误:(14,22)找不到匹配的资源给定的名称(在'src'
,值为'@ drawable / powered_by_google_light')。错误:执行
失败,执行任务':app:processDebugResources'。
$ b


com.android.ide.common.process.ProcessException :org.gradle.process.internal.ExecException:进程'命令
'/Users/Library/Android/sdk/build-tools/23.0.3/aapt''以
结束非零退出值1



这是我的app.gradle(摘录):

  apply plugin:'com.android.application'

android {

compileSdkVersion 23
buildToolsVersion '23 .0.3'


依赖关系{
编译fileTree(包括:['* .jar'],dir:'libs')
compile( 'com.google.android.gms:play-services-base:9.2.1'){
排除模块:'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'

这是我的主要gradle文件:

  buildscript { 
存储库{
jcenter()
}
依赖关系{
classpath'com.android.tools.build:gradle:2.1.2'
classpath' com.google.gms:google-services:3.0.0'
}
}

allprojects {
仓库{
jcenter()
}
}

现在,我正在使用一种解决方法,我正在从这里下载图标: https://developers.google.com/places/web-service/policies 并将它们合并到我的应用程序可绘制文件夹中。

解决方案

有些地方功能在v9.2中移入了自己的库。您需要将 com.google.android.gms:play-services-places:9.2.1 添加到您的Gradle文件中。


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

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.

解决方案

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.

这篇关于Android:在build tools 23.0.3中找不到资源powered_by_google_light图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆