我本来希望将此作为对原始问题的评论,但我没有足够的访问权限来发表评论.... 我尝试使用Android+Gradle: list directories into a file的答案用于使用AIDE开发的android java项目.... 据我所知,所有这些gradle / maven东西AIDE仍然使用gradle v 1。
从一般build.gradle文件中删除: 依赖项{classpath'com.android.tools.build:grad:1。+'}
所以我将全新的资产阅读任务添加到应用程序build.gradle(在应用程序主管中),现在看起来像这样:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.nohkumado.quelkar"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//try to compile a asset directory listing....
task indexAssets
{
description 'Index Build Variant assets for faster lookup by AssetManager later'
ext.assetsSrcDir = file( "${projectDir}/src/main/assets" )
ext.assetsBuildDir = file( "${buildDir}/assets" )
inputs.dir assetsSrcDir
//outputs.dir assetsBuildDir
doLast
{
android.applicationVariants.each
{
target ->
ext.variantPath = "${buildDir.name}/assets/${target.dirName}"
println "copyAssetRec:${target.dirName} -> ${ext.variantPath}"
def relativeVariantAssetPath = projectDir.name.toString() + "/" + ext.variantPath.toString()
def assetIndexFile = new File(relativeVariantAssetPath +"/assets.index")
def contents = ""
def tree = fileTree(dir: "${ext.variantPath}", exclude: ['**/.svn/**', '*.index'])
tree.visit
{
fileDetails ->
contents += "${fileDetails.relativePath}" + "\n"
}
assetIndexFile.write contents
}
}
}
indexAssets.dependsOn
{
tasks.matching { task -> task.name.startsWith( 'merge' ) && task.name.endsWith( 'Assets' ) }
}
tasks.withType( Compile )
{
compileTask -> compileTask.dependsOn indexAssets
}
}
dependencies {
compile project('::../UtilsApp:nohutils')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
所以我认为我做对了.....但似乎没有,将该任务添加到gradle文件,打破dependcies指令意味着突然我从外部库nohutils的所有导入都不再起作用了... ..
事实上,只要我宣布它就会发生,即使是一个空的“任务indexAssets”..... 不幸的是,每当我尝试应用我在gradle手册中阅读的内容时,在AIDE中失败并且由于AIDE没有任何手册,它只是在黑暗中涉足......
所以,如果有人有可能的解释/解决方案,我会很乐意接受它......