The Java-Eeditor has a simple Android interface.
As a teacher you can use the Android Studio to create a hull project for your students and make it available for further work in the Java-Editor. The students can then expand the hull project in their familiar development environment Java Editor.
Installation of Android SDK
Android Studio install installs the Android SDK automatically.
Install the Android SDK only. On the page Install Android Studio scroll to Get just the command line tools and install the command line tools. These contain the SDK- manager with which you can install these components after:
sdkmanager "build-tools;25.0.2" sdkmanager "platforms;android-25" sdkmanager "platform-tools"
Preparation of Java-Editor
Preparing an Android project
- Build the project with Android Studio.
- gradlew.bat must be present in the project folder and is usually created automatically by Android Studio.
- Delete or rename the local.properties file in the project folder if it exists.
Build & Install
- Open the file to be edited in the Java-Editor.
- If the apk is to be installed on a device, enable USB debugging on the device and connect the device via USB.
- Click the blue start icon. The first run will probably take a little longer, as components still have to be installed.
If no install happens even though a device is connected:
- be sure to connect only one device
- enable USB debugging on the device
- In the Android SDK, check if the file adb.exe exists in the folder sdk\platform-tools. Otherwise, adb should be installed with the Android SDk Manager.
- Look in the output of the Java-Editor for adb get-state to see the connection status. Alternatively check the connection with adb devices in the Windows command prompt.
In case of the error message Cannot resolve symbol 'R' reduce the Graddle version to 2.0.0 in the file build-gradle, which is located in the project folder of the app.
In case of the error message signatures do not match the previously installed version; Ignoring delete the old version of the app on the phone.
The demo app MyFirstApp shows what is possible in the Java-Editor with Android mode.
- In the Java-Editor open the MainActivity.java class from the folder /MyFirstApp/app/src/main/java/com/example/feli/myfirstapp
- You can see a programmatically added text field, a button and an input field.
- There is also the method sendMessage, which is linked to the button.
- If necessary, open DisplayMessageActivity.java.
- Alternatively, layout elements can be added in the activity_main.xml XML file from the MyFirstApp/app/src/main/res/layout folder.
- In the demo app in xml another button and another text field was created. The button is also linked to sendMessage.
- Changes can be made in the XML file within the Java-Editor. Then click Save, go back to MainActivity.java and hit the blue icon Transfer to Android.
- The app MyFirstApp is then on the phone in the list of installed apps.
For code completion download the file AndroidDocs.zip, unzip it and open the configuration via the Window menu. On the Java/Interpreter page, invoke Edit for JavaDoc-Folders and select the appropriate file from the unzipped zip file via allclasses-frame.html and save the changed settings.