问题描述
一切都很好,直到我将 android studio 更新到 Canary 6,当我重建或清理或其他项目时,它会抛出:
All was fine until i updated the android studio to Canary 6, When i rebuild or clean or whatever with project it's throw :
执行 com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction 时出错
这个错误引导我到我的 vectors.xml
[他们都得到了这个错误].
And this error guide me to my vectors.xml
[All of them got this error].
我当前的应用级别build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "example.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 42
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
//multiDexEnabled = true
}
buildTypes {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'//<-- can't update to new one
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:palette-v7:25.3.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}
此外,当我尝试下载 com.android.support
库时,IDE 只是搜索 sdk 而什么都不做.
Also when i tried to download com.android.support
libraries, The IDE just search for the sdk and just do nothing.
我尝试过的:
清理和重建.
Clean and Rebuild.
使缓存无效.
推荐答案
添加多密度矢量图的好处是使用矢量而不是位图来减小APK的大小,因为同一个文件的大小可以针对不同的屏幕密度进行调整,而不会降低图像质量.对于不支持矢量可绘制对象的旧版 Android,Vector Asset Studio 可以在构建时将矢量可绘制对象转换为针对每个屏幕密度的不同位图大小
The advantage of adding a multi-density vector graphic is to use a vector instead of a bitmap to reduce the size of the APK because the size of the same file can be adjusted for different screen densities without loss off image quality. For older versions of Android that don't support vector drawables, Vector Asset Studio can, at build time, turn your vector drawables into different bitmap sizes for each screen density
classpath 'com.android.tools.build:gradle:3.0.0-alpha8
build.gradle
build.gradle
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
这篇关于Android studio 3.0 Canary 6 执行 com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction 时发生故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!