Zum Inhalt springen

Android Training/Creating an Android Project/de: Unterschied zwischen den Versionen

Die Seite wurde neu angelegt: „Die [http://developer.android.com/guide/topics/manifest/manifest-intro.html Manifest Datei] beschreibt die fundamentalen Charakteristiken der App und definiert…“
(Die Seite wurde neu angelegt: „Ein Android Projekt enthält alle Dateien, die den Source-Code deiner Android App enthalten.“)
(Die Seite wurde neu angelegt: „Die [http://developer.android.com/guide/topics/manifest/manifest-intro.html Manifest Datei] beschreibt die fundamentalen Charakteristiken der App und definiert…“)
 
(9 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 2: Zeile 2:
Ein Android Projekt enthält alle Dateien, die den Source-Code deiner Android App enthalten.
Ein Android Projekt enthält alle Dateien, die den Source-Code deiner Android App enthalten.


This lesson shows how to create a new project either using Android Studio or using the SDK tools from a command line.
Diese Lektion zeigt dir, wie du ein neues Projekt entweder mit dem Android Studio oder mit der Kommandozeile mit Hilfe der SDK Tools erstellen kannst.


'''Note:''' You should already have the Android SDK installed, and if you're using Android Studio, you should also have [http://developer.android.com/sdk/installing/studio.html Android Studio] installed. If you don't have these, follow the guide to [http://developer.android.com/sdk/installing/index.html Installing the Android SDK] before you start this lesson.
'''Hinweis''': Du solltest bereits das Android SDK, sowie, wenn du Android Studio verwendest, auch das [http://developer.android.com/sdk/installing/studio.html Android Studio], installiert haben. Sollte dies nicht der Fall sein, folge dem Handbuch [http://developer.android.com/sdk/installing/index.html Installing the Android SDK], bevor du mit dieser Lektion startest.


== Create a Project with Android Studio ==
== Ein Projekt mit Android Studio erstellen ==
[[Datei:Adt-firstapp-setup.png|thumb|'''Figure 1.''' Configuring a new project in Android Studio.]]
[[Datei:Adt-firstapp-setup.png|thumb|'''Abbildung 1.''' Konfigurieren eines neuen Projektes in Android Studio.]]
# In Android Studio, create a new project:
# Erstelle ein neues Projekt in Android Studio:
#* If you don't have a project opened, in the '''Welcome''' screen, click '''New Project'''.
#* Wenn du kein Projekt geöffnet hast, klicke auf '''Neue Projekt''' in der '''Willkommen''' Ansicht.
#* If you have a project opened, from the '''File''' menu, select '''New Project'''.
#* Wenn du ein Projekt geöffnet hast, klicke '''Neues Projekt''' im '''Datei'''-Menü.
# Under '''Configure your new project''', fill in the fields as shown in figure 1 and click '''Next'''. It will probably be easier to follow these lessons if you use the same values as shown.
# Fülle die Felder unter '''Konfiguriere dein neues Projekt''' wie in Abbildung 1 gezeigt aus und klicke '''Weiter'''. Es ist wahrscheinlich einfacher den Übungen zu folgen, wenn du die gleichen Werte, wie gezeigt, nutzt.
#*'''Application Name''' is the app name that appears to users. For this project, use "My First App."
#* '''Applikations-name''' ist der Name der App, wie er für die Nutzer erscheint. Für dieses Projekt, nutze "My Frist App."
#*'''Company domain''' provides a qualifier that will be appended to the package name; Android Studio will remember this qualifier for each new project you create.
#* '''Unternehmensname''' stellt einen Kennzeichner zur Verfügung, welcher an den Paket-Namen angehängt wird; Android Studio wird sich diesen Kennzeichner für jedes neue Projekt merken, das du erstellst.
#*'''Package name''' is the fully qualified name for the project (following the same rules as those for naming packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. You can '''Edit''' this value independently from the application name or the company domain.
#* '''Paketname''' ist der voll qualifizierte Name für das Projekt (den gleichen Regeln folgend, wie für die Namensgebung von Paketen in der Java Programmiersprache). Dein Paket-Name muss einzigartig über alle installierten Pakete auf dem Android System sein. Du kannst ihn unabhängig vom App Namen oder der Unternehmens-Domain '''bearbeiten'''.
#Under '''Select the form factors your app will run on''', check the box for '''Phone and Tablet'''.
# Wähle unter '''Wähle die Bauformen, unter welchen deine App ausgeführt wird''' das Kontrollkästchen '''Telefon und Tablet''' aus.
#For '''Minimum SDK''', select '''API 8: Android 2.2 (Froyo)'''.
# Für '''Mindest-SDK''', wähle '''API 8: Android 2.2 (Froyo)''' aus.
#*The Minimum Required SDK is the earliest version of Android that your app supports, indicated using the [[API-Level|API level]]. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in [[Spezial:MyLanguage/Android Training/Supporting Different Platform Versions|Supporting Different Platform Versions]]).
#* Die mindestens benötigte SDK ist die früheste Android Version, welche deine App unterstützt, angezeigt durch den [[API-Level]]. Um so viele Geräte wie möglich zu unterstützen, solltest du die niedrigste verfügbare Version auswählen, welche es deiner App erlaubt, ihre Kernfunktionen auszuführen. Wenn eine Funktion deiner App eine neuere Android Version benötigt und nicht kritisch für die Kernfunktionalität deiner App ist, kannst du diese Funktion auch nur dann aktivieren, wenn eine unterstütze Version installiert ist (wie in [[Spezial:MyLanguage/Android Training/Supporting Different Platform Versions|Verschiedene Plattformversionen unterstützen]] beschrieben).
#Leave all of the other options (TV, Wear, and Glass) unchecked and click '''Next.'''
# Lasse alle anderen Optionen (TV, Wear und Glass) nicht ausgewählt und klicke '''Weiter'''.
#Under '''Add an activity to <''template''>''', select '''Blank Activity''' and click '''Next'''.
# Unter '''Eine Activity zu <''template''>''' hinzufügen''' wähle '''Leere Activity''' aus und klicke '''Weiter'''.
#Under '''Choose options for your new file''', change the '''Activity Name''' to ''MyActivity''. The '''Layout Name''' changes to ''activity_my'', and the '''Title''' to ''MyActivity''. The '''Menu Resource Name''' is''menu_my''.
# Unter '''Wähle Optionen für deine neue Datei aus''', ändere den '''Activity Namen''' zu '''MyActivity'''. Den '''Layout Namen''' änderst du zu ''activity_my'', und den '''Titel''' zu '''MyActivity'''. Der '''Menü-Ressourcen-Name''' ist ''menu_my''.
#Click the '''Finish''' button to create the project.
# Klicke '''Fertigstellen''' um das Projekt zu erstellen.
Your Android project is now a basic "Hello World" app that contains some default files. Take a moment to review the most important of these:
Dein Android Projekt ist jetzt eine Basis-"Hello World"-App, welche einige Standard-Dateien enthält. Nimm dir einen Moment und sieh dir die wichtigsten genauer an:
<code>app/src/main/res/layout/activity_my.xml</code>
<code>app/src/main/res/layout/activity_my.xml</code>
* This is the XML layout file for the activity you added when you created the project with Android Studio. Following the New Project workflow, Android Studio presents this file with both a text view and a preview of the screen UI. The file includes some default settings and a <code>TextView</code> element that displays the message, "Hello world!"
* Das ist die XML-Layout-Datei der Activity, die während der Erstellung des Projektes mit Androis Studio erstellt wurde. Dem neuen Projekt-Ablauf folgend, präsentiert Android Studio diese Datei sowohl mit einer Textbasierten Ansicht, wie einer Vorschau der Bildschirm-Oberfläche. Die Datei beinhaltet einige Standard-Einstellungen und ein <code>TextView</code> Element, welches die Nachricht "Hello worls!" anzeigt.
<code>app/src/main/java/com.mycompany.myfirstapp/MyActivity.java</code>
<code>app/src/main/java/com.mycompany.myfirstapp/MyActivity.java</code>
* A tab for this file appears in Android Studio when the New Project workflow finishes. When you select the file you see the class definition for the activity you created. When you build and run the app, the <code>Activity</code> class starts the activity and loads the layout file that says "Hello World!"
* Ein Tab für diese Datei erscheint dann in Android Studio, wenn der neue Projekt-Ablauf abgeschlossen wird. Wenn du die Datei auswählst, siehst du die Klassen-Definition für die Activity, welche du erstellt hast. Wenn du die App kompilierst und startest, wird die <code>Activity</code> Klasse die Aktivität starten und das Layout laden, welches "Hello World!" sagt.
<code>app/src/main/AndroidManifest.xml</code>
<code>app/src/main/AndroidManifest.xml</code>
* The [http://developer.android.com/guide/topics/manifest/manifest-intro.html manifest file] describes the fundamental characteristics of the app and defines each of its components. You'll revisit this file as you follow these lessons and add more components to your app.
* Die [http://developer.android.com/guide/topics/manifest/manifest-intro.html Manifest Datei] beschreibt die fundamentalen Charakteristiken der App und definiert jede ihrer Komponenten. Du wirst diese Datei erneut ansehen, wenn du den Übungen folgst und weitere Komponenten zu deiner App hinzufügst.
<code>app/build.gradle</code>
<code>app/build.gradle</code>
* Android Studio uses Gradle to compile and build your app. There is a <code>build.gradle</code> file for each module of your project, as well as a <code>build.gradle</code> file for the entire project. Usually, you're only interested in the<code>build.gradle</code> file for the module, in this case the <code>app</code> or application module. This is where your app's build dependencies are set, including the <code>defaultConfig</code> settings:
* Android Studio uses Gradle to compile and build your app. There is a <code>build.gradle</code> file for each module of your project, as well as a <code>build.gradle</code> file for the entire project. Usually, you're only interested in the<code>build.gradle</code> file for the module, in this case the <code>app</code> or application module. This is where your app's build dependencies are set, including the <code>defaultConfig</code> settings:
Zeile 51: Zeile 51:
# Change directories into the Android SDK’s <code>sdk/</code> path.
# Change directories into the Android SDK’s <code>sdk/</code> path.
# Execute:  
# Execute:  
:: <code>tools/android list targets</code>
#: <code>tools/android list targets</code>
:: This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target ID. We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.  If you don't see any targets listed, you need to install some using the Android SDK Manager tool. See [http://developer.android.com/sdk/installing/adding-packages.html Adding SDK Packages].
#: This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find the platform against which you want to compile your app. Make a note of the target ID. We recommend that you select the highest version possible. You can still build your app to support older versions, but setting the build target to the latest version allows you to optimize your app for the latest devices.  If you don't see any targets listed, you need to install some using the Android SDK Manager tool. See [http://developer.android.com/sdk/installing/adding-packages.html Adding SDK Packages].
# Execute:
# Execute:
:: <code>android create project --target <target-id> --name MyFirstApp \ --path <path-to-workspace>/MyFirstApp --activity MyActivity \ --package com.example.myfirstapp</code>
#: <code>android create project --target <target-id> --name MyFirstApp \ --path <path-to-workspace>/MyFirstApp --activity MyActivity \ --package com.example.myfirstapp</code>
:: Replace <code><target-id></code> with an ID from the list of targets (from the previous step) and replace <code><path-to-workspace></code> with the location in which you want to save your Android projects.
#: Replace <code><target-id></code> with an ID from the list of targets (from the previous step) and replace <code><path-to-workspace></code> with the location in which you want to save your Android projects.
'''Tip:''' Add the <code>platform-tools/</code> as well as the <code>tools/</code> directory to your <code>PATH</code> environment variable.
'''Tip:''' Add the <code>platform-tools/</code> as well as the <code>tools/</code> directory to your <code>PATH</code> environment variable.


11.008

Bearbeitungen

Cookies helfen uns bei der Bereitstellung von Android Wiki. Durch die Nutzung von Android Wiki erklärst du dich damit einverstanden, dass wir Cookies speichern.