Creating DroidScript Plugins on Desktop PC with Android Studio

Install Android Studio

1. Download and select the AndroidStudio executable on https://developer.android.com/studio/index.html
When having troubles or generally I suggest using the latest stable release package 'Windows IDE bundle with SDK' from https://developer.android.com/studio/archive.html
2. After installing Launch AndroidStudio

Download and Build the UserPlugin Template

3. Download the UserPlugin template from https://github.com/DroidScript/Plugin-UserPlugin and extract it to your AndroidStudio project folder
4. Select 'Open an existing Android Studio project' and navigate to the extracted UserPlugins folder
5. AndroidStudio will now generate some gradle related stuff and later ask you to update the gradle version Keep an eye on the message log and install missing components, packages and dependencies
6. After everything is installed you can build the APK. After the apk was built gradle will try to copy it to your device using adb - but this may fail (always consult the info log!) See point 8 how to handle this.
7. if adb was not found, open app/build.gradle in the UserPlugin project and paste the correct adb path

(for me it was C:\Users\user\AppData\Local\Android\sdk\platform-tools\adb)
You need to enable developer options and USB debugging on your device for that.
Also be sure that the .apk path to the generated apk and the target path on your device is correct.

Install the Plugin in DroidScript

8. Restart DroidScript on your device so that your plugin will be installed. Now you can try out an example from Docs/Plugins/MyPlugin
9. That's it - you have finally done the first steps to make great plugins :)



Additional informations to the files in your plugin project folder

app/assets/MyPlugin.inc

This is the JavaScript side of your plugin. It is recommended to create shortcuts to each of your plugin functions to simplify the calling process for the users You can also create a JavaScript plugin by writing your plugin code into this file - but there are easier ways ;)

app/assets/MyPlugin.html

This is the documentation page for your plugin inside DroidScript There you should

- explain what your plugin does - place clear and simple standalone examples of how to use the plugin - support a complete list of every available function with arguments and return values (feel free to use the DocsModifier app for that)

Comments

  1. very cool, congratulations, the question is will we be able to make an admob plugin, type generate a banner plugin to be added inside the droidcript layouts?

    ReplyDelete
    Replies
    1. Of course you will. You can add every control you want this way.
      In fact you can do everything like in normal java apps this way.

      Delete
    2. It might be worth doing some research in the DS forum because this was discussed a lot there.
      https://groups.google.com/forum/#!searchin/androidscript/admob%7Csort:date

      i.e. here Dave mentioned that the admob libraries could get into conflict with DS.
      https://groups.google.com/forum/#!topic/androidscript/7obr8qJ2EeM

      Delete

Post a Comment

Popular posts from this blog

Creating DroidScript Plugins on Mobile with AIDE - 2 (DS SDK)

Creating DroidScript Plugins on Mobile with AIDE

DroidScript Images