Tuesday, May 21, 2013

Re: [android-developers] Android Studio - Project Tree divergence from core platform tools ( is crazy !)

I certainly agree with the concepts in this video IO/session, and appreciate the feature of the new build system

However, my question is about :

1) the standard android project tree (and changes or abandonment thereof) , which this presentation does not mention...

2) the project tree  incompatibility I found today between the ../sdk/tools/android create project   and the Android Studio based new project creation. The android command is a deep and fundamental command from the android sdk, so for  Android Studio to create a android project tree that contradicts whats created by the android command  is misplaced ( stupid)

3) The lack of documentation regarding  changes to the standard android project tree -- if indeed that has changed in the new build system --  
http://developer.android.com/tools/projects/index.html  "The following directories and files comprise an Android project: src/ bin/ jni/ gen/ assets/ res/ raw/  libs/ AndroidManifest.xml "



Sanjay


On Tuesday, May 21, 2013 12:01:39 PM UTC-7, Tor Norbye wrote:
This is done as part of the new build system -- here's the talk from Google I/O last week:


On Tue, May 21, 2013 at 11:56 AM, Sanjay Mishra <smi...@gmail.com> wrote:
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 


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.
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. 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 for more information.
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 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 aPreferenceScreenAppWidgetProviderInfo, or Searchability Metadata. See Application Resources for more information about configuring these application components.
libs/
Contains private libraries.
AndroidManifest.xml
The 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 documentation for more information
project.properties
This 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 selectProperties.
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-d...@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.
 
 

--
--
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