gpt4 book ai didi

android - 当 Google Play 服务添加为依赖项时无法使用 gradle 构建

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:53:17 25 4
gpt4 key购买 nike

我正在尝试将 Google Play 服务添加到我的项目中以使用 MapView,但是当我将其添加到 build.gradle compile "com.google.android.gms:play-services:5.2.08" 我遇到了构建错误

:app:mergeDebugResources
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png ERROR: Unable to open PNG file
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-hdpi\common_signin_btn_icon_focus_light.9.png ERROR: Unable to open PNG file
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-xhdpi\common_signin_btn_icon_normal_light.9.png ERROR: Unable to open PNG file
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-mdpi\ic_plusone_medium_off_client.png ERROR: Unable to open PNG file
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-xhdpi\common_signin_btn_text_normal_dark.9.png ERROR: Unable to open PNG file
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-xhdpi\common_signin_btn_text_pressed_dark.9.png ERROR: Unable to open PNG file
Error:Failed to run command:
C:\...\AndroidStudio\sdk\build-tools\android-4.4W\aapt.exe s -i D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png -o D:\...\app\build\intermediates\res\debug\drawable-mdpi-v4\common_signin_btn_text_disabled_focus_light.9.png
Error Code:
42
Output:
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png ERROR: Unable to open PNG file
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: Failed to run command:
C:\...\AndroidStudio\sdk\build-tools\android-4.4W\aapt.exe s -i D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png -o D:\...\app\build\intermediates\res\debug\drawable-mdpi-v4\common_signin_btn_text_disabled_focus_light.9.png
Error Code:
42
Output:
D:\...\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\5.2.08\res\drawable-mdpi\common_signin_btn_text_disabled_focus_light.9.png ERROR: Unable to open PNG file

我的build.gradle文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

defaultConfig {
applicationId "com.test.myapp"
minSdkVersion 'L'
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:21.0.0-rc1'
compile 'com.android.support:palette-v7:21.0.0-rc1'
compile 'com.android.support:cardview-v7:21.0.0-rc1'
compile 'com.android.support:support-v13:21.0.0-rc1'

compile "com.google.android.gms:play-services:5.2.08"
}

我在 SDK Manager 上安装了 Extras、Android L、Android 4.4W 和 Android 4.4.2 中的所有内容(所有内容都是最新的)

尝试添加 compile 'com.android.support:appcompat-v7:21.0.0-rc1' ,重建项目,仍然不起作用

最佳答案

感谢 this post !导致问题的文件路径大于 260 个字符,无法在 NTFS 文件系统上工作(抱歉,我忘了说我使用的是 Windows 7)

您可以选择此工具 http://www.ntwind.com/software/utilities/visual-subst.html缩短路径并克服 mergeDebugResource 异常

关于android - 当 Google Play 服务添加为依赖项时无法使用 gradle 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25260154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com