New Android Project not creating Layout or Java file

I have been trying, for 2 days now, to simply get past the first few pages of the first chapter of Big Nerd Ranch's Android Programming Book.

The gist of my problem is that when I create a new Android app, no layout or .java files are created.

I have installed the ADT Bundle (which includes Eclipse and the SDK) from the Android dev site. I have also installed Eclipse on my own, updated Java on my Mac, and manually downloaded the SDK. In both scenarios I am running ADT version 23.0.

Here are some screenshots of what I'm doing:

Creating the project

The Project workspace right after creating:

The Installed ADT Tools

The installed SDKs and API Levels

I also read on the dev forums that there are some issues with version 23.0, and that things like ProGuard, SQLite3, and other items are missing, which I have copied into the Android SDK folder where everything is located.

And yet, it doesn't work. No matter what API Level I target, I cannot get the layout and java file to create. Any ideas and solutions? I know there is Android studio but I really want to learn it with Eclipse for legacy support, and as this is what most books use for teaching. Plus, there is no support for the NDK yet, from what I have read, which is also of interest to me.

Answers


I had this kind of "bug" the first time I used Eclipse ADT too. In my case uninstall and reinstalling fixed the problem.

However as the comments told you, it's no big deal to have the files created automatically for you, except in the case you're totally new to Android and doesn't know what you may miss if you create the file from scratch.. which was also my case.

But in case you are still bugged by the problem then this might help. Usually these 3 files are created automatically for you, but in case they would not, then make them on your own by copy-pasting these:

AppNameHere\res\layout\activity_main.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.anything.appnamehere.MainActivity"
    tools:ignore="MergeRootFrame" />

AppNameHere\res\layout\fragment_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.anything.appnamehere.MainActivity$PlaceholderFragment" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

</RelativeLayout>

AppNameHere\src\com.anything.appnamehere\MainActivity.java

package com.anything.appnamehere;
public class MainActivity extends Activity{

}

These codes are for my app which is named com.anything.appnamehere, please modify to suit your need.


OK, So after several hours of experimentation and research, there is currently no way to create a default Android project with the Rev 23.0 version of the ADT Tools.

Here is what I did form scratch to get things working on my computer. I'm running OS X 10.9.3:

  1. Downloaded the Java JDK 7u60 from here: Java JDK for Mac
  2. Downloaded Eclipse Luna 64-bit from here: Eclipse Luna 64-Bit Mac
  3. Downloaded the Android SDK version 22.6.3 here: Android SDK 22.6.2 Mac
  4. Downloaded the ADT tools version 22.6.3 from here: ADT 22.6.3 Mac

    • I first put the Android SDK folder, unzipped, in my Applications directory and renamed it to "Android SDK" (You can use whatever you want or put it elsewhere.
    • Afterwards, I went into Eclipse > Help > Install New Software...
    • Then I clicked on Add > Archive > .Zip file for ADT 22.6.3
    • Launched Eclipse and was promoted to select the SDK location, so in Eclipse's preferences I selected the folder I put inside my Applications directory.
    • Updated the Android SDK built tools and downloaded the SDKs for the API levels I wanted. Note that I did NOT update the Android SDK Tools to the Rev 23 update available. This is what's broken and has things like ProGuard, SQLite, and other items missing (it's because it was released earlier this week for the L Preview).

And that's it, I am now able to create an application and the .java and activity files are there.

As mentioned by Mr. Kro, there are differences between the book and the SDK, but this is to be expected after ~1 year since its release. In any case this is going to help you if you are having the same trouble as I am. And with this you can use the latest Eclipse and the latest stable Android SDK/ADT, until Google patches Rev 23.


Need Your Help

Jump out from the website

objective-c ios cocoa-touch nsurlconnection

I'm newbie in iOS app with internet connection.

Disabling Tabs in Bootstrap

javascript jquery javascript-events twitter-bootstrap

I am trying to disable the tabs in bootstrap. I have been researching and I have not yet found a solution.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.