I was baffled to find that a new Android Project created via Android Studio creates a project tree (on the file system) which shows significant divergence from the standard android project tree defined in the Android sdk documentation.
One of the greatest attributes of the Android project is that well defined project structure linked below :
And both the "android" command that comes from Android sdk/tools/ and the Eclipse based ADT tool create a consistent well defined directory tree... such that they are compatible
That common standard Android Project tree is the common ground that supported diverse IDEs( Eclipse ADT, Netbeans, IDEA ) and ant based builds.
Using android, ADT and the ant based build that comes off the shelf with the Android SDK, one had both the IDE and the command line build working off the same standard tree seamlessly.
ie.
$ android create project --target 26 --name XyzApp --path ./MyAndroidAppProject --activity XyzAppActivity --package com.example.xyz
and the Eclipse/ADT based IDE created the standard tree
( cut and pasted from http://developer.android.com/tools/projects/) :-
src/
src/your/package/namespace/ActivityName.java
. All other source code files (such as .java
or .aidl
files) go here as well.bin/
.apk
file and other compiled resources.jni/
gen/
R.java
file and interfaces created from AIDL files.assets/
.apk
file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager
. For example, this is a good location for textures and game data.res/
anim/
- For XML files that are compiled into animation objects. See the Animation resource type.
color/
- For XML files that describe colors. See the Color Values resource type.
drawable/
- For bitmap files (PNG, JPEG, or GIF), 9-Patch image files, and XML files that describe Drawable shapes or Drawable objects that contain multiple states (normal, pressed, or focused). See the Drawable resource type.
layout/
- XML files that are compiled into screen layouts (or part of a screen). See the Layout resource type.
menu/
- For XML files that define application menus. See the Menus resource type.
raw/
- For arbitrary raw asset files. Saving asset files here instead of in the
assets/
directory only differs in the way that you access them. These files are processed by aapt and must be referenced from the application using a resource identifier in theR
class. For example, this is a good place for media, such as MP3 or Ogg files. values/
- For XML files that are compiled into many kinds of resource. Unlike other resources in the
res/
directory, resources written to XML files in this folder are not referenced by the file name. Instead, the XML element type controls how the resources is defined within them are placed into theR
class. xml/
- For miscellaneous XML files that configure application components. For example, an XML file that defines a
PreferenceScreen
,AppWidgetProviderInfo
, or Searchability Metadata. See Application Resources for more information about configuring these application components.
libs/
AndroidManifest.xml
project.properties
On the other hand, a new project I created via Android Studio came up with a whole different project tree.
.
./libs
./libs/android-support-v4.jar
./src
./src/main
./src/main/java
./src/main/java/com
./src/main/java/com/example
./src/main/java/com/example/firsttest
./src/main/java/com/example/firsttest/SettingsActivity.java
./src/main/res
./src/main/res/xml
./src/main/res/xml/pref_data_sync.xml
./src/main/res/xml/pref_general.xml
./src/main/res/xml/pref_headers.xml
./src/main/res/xml/pref_notification.xml
./src/main/res/drawable-mdpi
./src/main/res/drawable-mdpi/ic_launcher.png
./src/main/res/values
./src/main/res/values/strings_activity_settings.xml
./src/main/res/values/strings.xml
./src/main/res/values/styles.xml
./src/main/res/drawable-xhdpi
./src/main/res/drawable-xhdpi/ic_launcher.png
./src/main/res/values-v11
./src/main/res/values-v11/styles.xml
./src/main/res/drawable-hdpi
./src/main/res/drawable-hdpi/ic_launcher.png
./src/main/AndroidManifest.xml
src/main has res etc, but libs is at a different level (../..) but stepping back for moment ...
Not sure if the claim in Google I/O about how Android Studio was a step in the direction of a consistent build & consistency with the sdk tools, command line builds etc, is valid, if indeed Android Studio imposes a new project directory structure inconsistent with the standard project tree documented at developer.android.com/
Much as I am not a big fan of eclipse, at least the eclipse ADT created a project directory tree consistent with the command line core sdk tools such as the "android" command and could co-exist with the command line tools and the ant based builds/ automated builds and such.
So why start a whole new structure ... that's inconsistent with the already defined android sdk documentation on what makes a standard android project tree ?
I respect the IntelliJ/ IDEA from JetBrains and am not a fan of eclipse( too many fundamental flaws). And gradle is a great tool. And while particular features in Android Studio are quite impressive, I am not sure how the issue of the project tree divergence is to be resolved in the long run?
Perhaps I am missing something here ? IMO It certainly does not make sense if Android Studio and the gradle based build are to be interoperable together while being incompatible with the already well defined and valuable standard android project tree defined in the Android SDK documentation from the start. http://developer.android.com/tools/projects/index.html
Thanks
Sanjay
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment