简体   繁体   English

Android库项目与库模块google play服务错误

[英]Android Studio project with library module google play services error

I'm having this problem that so many devs do: 我有这么多开发人员做的这个问题:

Error:No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

What's different about my project is the play services dependency comes from a library (that I control) which I've included as an AAR file. 我的项目有什么不同,游戏服务依赖来自一个库(我控制),我把它作为AAR文件包含在内。

Library 图书馆

build.gradle: compile 'com.google.android.gms:play-services-base:10.2.1' build.gradle:compile'c​​om.google.android.gms: compile 'com.google.android.gms:play-services-base:10.2.1'

manifest: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> manifest: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

App project 应用项目

Top level build file: 顶级构建文件:

repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }

The AAR is in the libs directory. AAR位于libs目录中。

Module build file: compile(name:'app-debug', ext:'aar') 模块构建文件: compile(name:'app-debug', ext:'aar')

That is the only dependency. 这是唯一的依赖。 I also tried it like this: 我也尝试过这样:

compile(name:'app-debug', ext:'aar') {
        transitive = true;
    }

but no change. 但没有变化。 That was based on this question, which is the closest I've found to my situation, but that person is including the dependency as a maven artifact: Error with google_play_services_version value from aar library 这是基于这个问题,这是我发现的最接近我的情况,但是那个人将依赖项包含为maven工件: 来自aar库的google_play_services_version值出错

Please let me know if you need to see anything else. 如果您需要查看其他任何内容,请与我们联系。

本地aar文件不包含项目的依赖项,因此您应该将库使用的所有依赖项(包括Google位置服务)手动包含到应用程序的build.gradle文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM