From 63d8ee9a4821b3cee7dc388fac5246711f6d6bb6 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Wed, 24 Apr 2019 18:32:06 -0300 Subject: [PATCH] Fixes for the new Android tutorials --- about/docs_changelog.rst | 3 ++ .../workflow/export/android_custom_build.rst | 34 ++++++++----------- tutorials/plugins/android/android_plugin.rst | 27 +++++++-------- tutorials/plugins/android/index.rst | 4 +-- 4 files changed, 32 insertions(+), 36 deletions(-) diff --git a/about/docs_changelog.rst b/about/docs_changelog.rst index 2e5837f96..e1a6fddb7 100644 --- a/about/docs_changelog.rst +++ b/about/docs_changelog.rst @@ -22,6 +22,8 @@ Step-by-step Project workflow ^^^^^^^^^^^^^^^^ +- :ref:`Custom builds for Android ` + Best Practices: - :ref:`Introduction ` - :ref:`What are Godot classes ` @@ -150,3 +152,4 @@ Plugins - :ref:`Making main screen plugins ` - :ref:`Spatial gizmo plugins ` +- :ref:`Creating Android plugins ` diff --git a/getting_started/workflow/export/android_custom_build.rst b/getting_started/workflow/export/android_custom_build.rst index 56bc7a745..8e6bd4d3c 100644 --- a/getting_started/workflow/export/android_custom_build.rst +++ b/getting_started/workflow/export/android_custom_build.rst @@ -1,7 +1,7 @@ .. _doc_android_custom_build: Custom builds for Android -===================== +========================= Godot provides the option to use custom build Android templates. Instead of using the already pre-built template that ships with Godot, an actual Android Java project gets installed into your project folder. Godot will then build it and use it as @@ -17,7 +17,7 @@ Configuring custom build is a more or less straightforward process, but it may t Instructions will be provided as detailed as possible to do this process. Set up the Custom Build environment ------------------------------------- +----------------------------------- Go to the Project menu, and install the *Custom Build* template: @@ -38,7 +38,7 @@ Install Java Android SDK does not come with Java, so it needs to be installed manually. Instal Java SDK (**not** runtime or JRE). OpenSDK 8 is recommended, otherwise Oracle's Java SDK for version 8 will work. Later versions may not work for Android development. Download the command line tools -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Go to Google's website for downloading the Android SDK. A search will take you to the *Android Studio* download page. You don't want it, so don't download (if you do want it, read further down for instructions for doing the same using Android Studio). @@ -59,13 +59,13 @@ This may appear a little confusing, but be sure to follow these instructions car C:\users\\Documents\android-sdk - is often good enough. Unzip the *sdk zip file* you just downloaded there. The only thing in the directory you created in the previous step should be the *tools* folder with it's contents inside, like this: +is often good enough. Unzip the *sdk zip file* you just downloaded there. The only thing in the directory you created in the previous step should be the *tools* folder with it's contents inside, like this: :: - android-sdk/ - android-sdk/tools/ - android-sdk/tools/allthefiles + android-sdk/ + android-sdk/tools/ + android-sdk/tools/allthefiles Accepting the Licenses @@ -93,7 +93,7 @@ Afterwards, install the platform tools (this is needed to install *adb*): Generating the Keystore -^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^ Once *platform tools* are installed, the last step is to generate a debug keystore (this is needed to build). Go up two folders by writing: @@ -135,7 +135,7 @@ With this, you should be all set. Install the Android SDK (Android Studio) ----------------------------------------------- +---------------------------------------- If you just finished installing the SDK via command line tools, feel free to skip this section entirely. The Android Studio path is easier, but it takes up more disk space. It's also useful if you plan to develop Godot for Android (modify the Java source code) or if you plan to develop Add-Ons. @@ -152,7 +152,7 @@ In any case, it's better to select a different path inside your user folders. Th :: - C:\Users\\Documents\android-sdk + C:\Users\\Documents\android-sdk Replace *yourusername* by your actual user name. Once it's correct, select from the list above in the same screen: @@ -163,7 +163,7 @@ The rest are not needed, because the build system will fetch them itself. After Generating the Keystore -^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^ You thought that by going the Android Studio way you could escape the Keystore generation, but no. It's back to haunt you. @@ -202,7 +202,7 @@ With this, you should be all set. Enabling Custom Build and Exporting ------------------------------------- +----------------------------------- When setting up the Android project in the *Project -> Export* dialog, *custom build* needs to be enabled: @@ -212,11 +212,5 @@ From now on, attempting to export the project or one-click deploy will call the .. image:: img/custom_build_gradle.png -The templates built will be used automatically afterwards, so no further configuration is needed. - - - - - - - +The templates built will be used automatically afterwards, so no further +configuration is needed. diff --git a/tutorials/plugins/android/android_plugin.rst b/tutorials/plugins/android/android_plugin.rst index 3df2ceaba..f283a6cd7 100644 --- a/tutorials/plugins/android/android_plugin.rst +++ b/tutorials/plugins/android/android_plugin.rst @@ -1,6 +1,6 @@ .. _doc_android_plugin: -Creating Android Plugins +Creating Android plugins ======================== Introduction @@ -39,7 +39,7 @@ It is also possible that you just want to do modifications to the Android export can remain compatible with newer Godot versions (as the android source template will get updated on each release). Maybe REST ------------ +---------- Most of these APIs allow communication via REST/JSON APIs. If the API is relatively simple and does not require complex authenthication, this may be a better idea than writing a specific Android plugin. @@ -184,7 +184,7 @@ A singleton object template follows: private int instanceId = 0; public int myFunction(String p_str) { - // a function to bind + // A function to bind. return 1; } @@ -198,7 +198,7 @@ A singleton object template follows: } public MySingleton(Activity p_activity) { - //register class name and functions to bind + // Register class name and functions to bind. registerClass("MySingleton", new String[] { "myFunction", @@ -206,19 +206,19 @@ A singleton object template follows: }); this.appActivity = p_activity; this.appContext = appActivity.getApplicationContext(); - // you might want to try initializing your singleton here, but android - // threads are weird and this runs in another thread, so to interact with Godot you usually have to do + // You might want to try initializing your singleton here, but android + // threads are weird and this runs in another thread, so to interact with Godot you usually have to do. activity.runOnUiThread(new Runnable() { public void run() { - //useful way to get config info from project.godot + // Useful way to get config info from "project.godot". String key = GodotLib.getGlobal("plugin/api_key"); - //SDK.initializeHere(); + // SDK.initializeHere(); } }); } - // forwarded callbacks you can reimplement, as SDKs often need them + // Forwarded callbacks you can reimplement, as SDKs often need them. protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {} protected void onMainRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {} @@ -228,12 +228,12 @@ A singleton object template follows: protected void onMainDestroy() {} protected void onGLDrawFrame(GL10 gl) {} - protected void onGLSurfaceChanged(GL10 gl, int width, int height) {} // singletons will always miss first onGLSurfaceChanged call + protected void onGLSurfaceChanged(GL10 gl, int width, int height) {} // Singletons will always miss first 'onGLSurfaceChanged' call. } Calling back to Godot -~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^ Calling back to Godot from Java is a little more difficult. The instance ID of the script must be known first, this is obtained by calling @@ -245,7 +245,7 @@ Java will most likely run in a separate thread, so calls are deferred: .. code:: java - GodotLib.calldeferred(, "", new Object[]{param1,param2,etc}); + GodotLib.calldeferred(, "", new Object[]{param1, param2, etc}); Godot will detect this singleton and initialize it at the proper time. @@ -255,7 +255,7 @@ Troubleshooting --------------- Godot crashes upon load -~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^ Check ``adb logcat`` for possible problems, then: @@ -277,4 +277,3 @@ It's simple to use and it's used like this: This is most likely not functional yet, if you want to test it and help us make it work, contact us on irc.freenode.org:#godotengine-devel. - diff --git a/tutorials/plugins/android/index.rst b/tutorials/plugins/android/index.rst index 18535b11a..9f60e1b4e 100644 --- a/tutorials/plugins/android/index.rst +++ b/tutorials/plugins/android/index.rst @@ -1,5 +1,5 @@ -Android Plugins -================ +Android plugins +=============== .. toctree:: :maxdepth: 1