Android studio 3.0 Canary 6 执行 com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction 时出现故障
Android studio 3.0 Canary 6 A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
在我将 android 工作室更新到 Canary 6 之前,一切都很好,当我重建或清理或抛出任何项目时:
A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
这个错误引导我 vectors.xml
[他们都遇到了这个错误]
.
我当前的应用级别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 而什么都不做。
我尝试过的:
清理并重建。
使缓存无效。
android studio canary 6 存在很多问题,解决该问题的最佳方法是将 gradle 中依赖项中的 class 路径更改为
classpath 'com.android.tools.build:gradle:2.3.3'
添加多密度矢量图形的优点是使用矢量而不是位图来减小 APK 的大小,因为可以针对不同的屏幕密度调整同一文件的大小,而不会损失图像质量.对于不支持矢量可绘制对象的旧版本 Android,Vector Asset Studio 可以在构建时将您的矢量可绘制对象转换为针对每种屏幕密度的不同位图大小
classpath 'com.android.tools.build:gradle:3.0.0-alpha8
build.gradle
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
将 vectorDrawables.useSupportLibrary = true
添加到 build.gradle(模块)的 defaultConfig 对我有用。 :)
我遇到了同样的问题。有两种方法可以解决我的问题:
- 添加
vectorDrawables.useSupportLibrary = true
在我的可绘制矢量 xml 文件中有指向 @color
:
的链接
<path
android:fillColor="@color/white"
...
我替换成
<path
android:fillColor="#fff"
...
问题消失了。
只需在 defaultConfig 中添加 vectorDrawables.useSupportLibrary = true,对我来说效果很好
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
将此添加到 defaultConfig
下的 build.gradle
vectorDrawables.useSupportLibrary = true
。
这将解决您的问题。
问题出在版本 gradle 3.1.4 上。降级到 3.1.3 就可以了
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
在我将 android 工作室更新到 Canary 6 之前,一切都很好,当我重建或清理或抛出任何项目时:
A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
这个错误引导我 vectors.xml
[他们都遇到了这个错误]
.
我当前的应用级别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 而什么都不做。
我尝试过的:
清理并重建。
使缓存无效。
android studio canary 6 存在很多问题,解决该问题的最佳方法是将 gradle 中依赖项中的 class 路径更改为
classpath 'com.android.tools.build:gradle:2.3.3'
添加多密度矢量图形的优点是使用矢量而不是位图来减小 APK 的大小,因为可以针对不同的屏幕密度调整同一文件的大小,而不会损失图像质量.对于不支持矢量可绘制对象的旧版本 Android,Vector Asset Studio 可以在构建时将您的矢量可绘制对象转换为针对每种屏幕密度的不同位图大小
classpath 'com.android.tools.build:gradle:3.0.0-alpha8
build.gradle
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
将 vectorDrawables.useSupportLibrary = true
添加到 build.gradle(模块)的 defaultConfig 对我有用。 :)
我遇到了同样的问题。有两种方法可以解决我的问题:
- 添加
vectorDrawables.useSupportLibrary = true
在我的可绘制矢量 xml 文件中有指向
的链接@color
:<path android:fillColor="@color/white" ...
我替换成
<path android:fillColor="#fff" ...
问题消失了。
只需在 defaultConfig 中添加 vectorDrawables.useSupportLibrary = true,对我来说效果很好
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
将此添加到 defaultConfig
build.gradle
vectorDrawables.useSupportLibrary = true
。
这将解决您的问题。
问题出在版本 gradle 3.1.4 上。降级到 3.1.3 就可以了
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}