Zum Inhalt springen

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

Neue Version von externer Quelle importiert
(Neue Version von externer Quelle importiert)
 
(Neue Version von externer Quelle importiert)
 
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 20: Zeile 20:
#Leave all of the other options (TV, Wear, and Glass) unchecked and click '''Next.'''
#Leave all of the other options (TV, Wear, and Glass) unchecked and click '''Next.'''
#Under '''Add an activity to <''template''>''', select '''Blank Activity''' and click '''Next'''.
#Under '''Add an activity to <''template''>''', select '''Blank Activity''' and click '''Next'''.
#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''.
#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''.
#Click the '''Finish''' button to create the project.
#Click the '''Finish''' button to create the project.
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:
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:
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.


372

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.