A
A
Alexander Vasyuchenko2015-09-21 09:18:21
Android
Alexander Vasyuchenko, 2015-09-21 09:18:21

How to write Gradle script for Android Studio?

Good afternoon!
Please tell me how to write instructions in the Gradle script so that when compiling the project, a text file with the content that I want is generated and this file is placed in the application's assets?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Varakosov, 2015-09-21
@alexv1981

1. In Android Studio, create a folder for assets. Right click on app -> New -> Folder -> Assets Folder. This will also add asset generation to Gradle.
2. In buildscript, add task, for example:

task runSomePython(type:Exec) {
   workingDir 'path_to_script'

   commandLine 'python', 'somescript.py'
}

To start generating the files you need. You need to put files in src/main/assets/.
However, generating the contents of assets on the fly smacks of perversions. What for text files when there are xml to which it is possible to address freely.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question