我有这样的项目结构: ProjectFolder/IosFolder,AndroidFolder,CommonFolder 现在安卓应用程序使用来自其assets文件夹的文件。 但我们决定为相同的文件创建Common文件夹。
你能帮我编写一个函数,它可以将文件从Common文件夹(此文件夹在我的项目下,因此在Android Studio中看不到)复制到安卓assets文件夹,在应用程序构建之前?
Common文件夹中将有一些.json文件和字体文件。
据我所了解,我需要在我的build.gradle文件中编写此函数,类似于:
task copyFiles(type: Copy)
copyFiles {
description = 'Copy files'
from 'Common/'
into 'Android/{projectName}/app/src/main/assets'
}
这是我的文件:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "amc.amc_mobile_promo2"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
//For Flurry
multiDexEnabled = true
}
//For Flurry
/*compileOptions {
//noinspection GroovyAssignabilityCheck
sourceCompatibility JavaVersion.VERSION_1_7
//noinspection GroovyAssignabilityCheck
targetCompatibility JavaVersion.VERSION_1_7
}*/
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'joda-time:joda-time:2.8.2'
compile 'com.github.orangegangsters:swipy:1.2.0@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.6.0'
/*compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'*/
}
请问我在Gradle控制台中如何查看已执行方法的结果?
我需要在build.gradle文件的哪个位置使用什么路径来调用这个方法?
希望你能帮助我。