Benutzer-Werkzeuge

Webseiten-Werkzeuge


en:android

Android

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

Possibility 1

Android Studio install installs the Android SDK automatically.

Possibility 2

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

In the Configuration section of the Java-Editor, on the Android page, select the path to the Android SDK folder and enable Android mode.

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.

Troubleshooting

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.

Demo-App

The demo app MyFirstApp shows what is possible in the Java-Editor with Android mode.

Java Code
  • 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.
XML-Layout
  • 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.

Code-Completion

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.

en/android.txt · Zuletzt geändert: 2018/12/21 21:50 von roehner