我目前正在使用Android实验性gradle插件。我需要在res中有多个自定义子文件夹但是当我与主java源srcDirs结合时,它将始终提示错误消息
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe''
finished with non-zero exit value 1
我的gradle版本是2.5
为实验性gradle版本配置android.sources的正确方法是什么
在我的应用 build.gradle 文件中:
apply plugin: 'com.android.model.application'
...
android.sources {
main {
java {
source {
srcDirs = ["src"]
}
}
res{
source {
srcDirs = [ 'src/main/res/property/search',
'src/main/res/property',
'src/main/res/agent',
'src/main/res'
]
}
}
}
}
答案 0 :(得分:0)
我用于build.gradle的当前最新和标准配置:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.xyz"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.mikhaellopez:circularimageview:2.0.2'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile files('libs/picasso-2.0.0.jar')
compile 'com.github.rahatarmanahmed:circularprogressview:2.4.0'
}
答案 1 :(得分:0)
我认为您需要在Android之前添加模型标记,就像它
一样apply plugin: 'com.android.model.application'
...
model.android.sources {
main {
java {
source {
srcDir = 'src'
}
}
res {
source {
srcDirs = ['src/main/res/property/search',
'src/main/res/property',
'src/main/res/agent',
'src/main/res'
]
}
}
}
}