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 :
http://developer.android.com/tools/projects/index.html

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.

http://developer.android.com/tools/projects/projects-cmdline.html

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/<http://developer.android.com/tools/projects/index.html>)
 
:-

src/
Contains your stub Activity file, which is stored at src*
/your/package/namespace/ActivityName*.java. All other source code files 
(such as .java or .aidl files) go here as well.bin/Output directory of the 
build. This is where you can find the final .apk file and other compiled 
resources.jni/Contains native code sources developed using the Android NDK. 
For more information, see the Android NDK 
documentation<http://developer.android.com/tools/sdk/ndk/index.html>
.gen/Contains the Java files generated by ADT, such as your R.java file and 
interfaces created from AIDL files.assets/This is empty. You can use it to 
store raw asset files. Files that you save here are compiled into an .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<http://developer.android.com/reference/android/content/res/AssetManager.html>.
 
For example, this is a good location for textures and game data.res/Contains 
application resources, such as drawable files, layout files, and string 
values. See Application 
Resources<http://developer.android.com/guide/topics/resources/index.html> for 
more information.anim/For XML files that are compiled into animation 
objects. See the 
Animation<http://developer.android.com/guide/topics/resources/animation-resource.html>
 resource 
type.color/For XML files that describe colors. See the Color 
Values<http://developer.android.com/guide/topics/resources/color-list-resource.html>
 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<http://developer.android.com/guide/topics/resources/drawable-resource.html>
 resource 
type.layout/XML files that are compiled into screen layouts (or part of a 
screen). See the 
Layout<http://developer.android.com/guide/topics/resources/layout-resource.html>
 resource 
type.menu/For XML files that define application menus. See the 
Menus<http://developer.android.com/guide/topics/resources/menu-resource.html> 
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 the R 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 the R class.xml/For 
miscellaneous XML files that configure application components. For example, 
an XML file that defines 
aPreferenceScreen<http://developer.android.com/reference/android/preference/PreferenceScreen.html>
, 
AppWidgetProviderInfo<http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html>,
 
or Searchability 
Metadata<http://developer.android.com/reference/android/app/SearchManager.html#SearchabilityMetadata>.
 
See Application 
Resources<http://developer.android.com/guide/topics/resources/index.html> for 
more information about configuring these application components.libs/Contains 
private libraries.AndroidManifest.xmlThe control file that describes the 
nature of the application and each of its components. For instance, it 
describes: certain qualities about the activities, services, intent 
receivers, and content providers; what permissions are requested; what 
external libraries are needed; what device features are required, what API 
Levels are supported or required; and others. See the 
AndroidManifest.xml<http://developer.android.com/guide/topics/manifest/manifest-intro.html>
 documentation 
for more informationproject.propertiesThis file contains project settings, 
such as the build target. This file is integral to the project, so maintain 
it in a source revision control system. To edit project properties in 
Eclipse, right-click the project folder and select*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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to