4

With the new SDK Tools and ADT versions 22.6.2, the default options for creating a new project with a blank activity produces a project which uses Fragments and refers to a library project (a new one for each project) named appcompat_v7_x.

The relevant parts of the stub code for the main activity are:

package com.myname.miniandroid;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
.....
.....

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    ....
    }

    public static class PlaceholderFragment extends Fragment {
    ......
    ......    
    }

}

. We can see that it uses a Fragment and an ActionBarActivity. The automatically created library project has both the v4 and the v7 jars in its libs folder, the main project has just the v4 jar. As built by default, hovering over either of these classes gives no javadoc information.

To get such support I've had to :

1) insert a file android-support-v7-appcompat.jar.properties into the libs folder of my automatically created appcompat_v7_4 library project. It contains the lines:

doc=c:\\dev\\tools\\android-sdk-windows4.4\\docs\\reference
src=C:\\dev\\tools\\android-sdk-windows4.4\\extras\\android\\support\\v7\\appcompat\\src

(Both lines seem to be necessary)

2) insert a file anndroid-support-v4.jar.properties into the libs folder of the main project. It contains the line:

src=C:\\dev\\tools\\android-sdk-windows4.4\\extras\\android\\support\\v4\\src

3) Close and reopen both projects and clean all projects.

I've got a brand new installation of Eclipse Kepler and an up to date installation of the SDK.

I feel that there must be a quicker way of getting set up to start a new project with the recommended default options. If anyone can tell me what it is, I would be most grateful.

NickT
  • 23,844
  • 11
  • 78
  • 121

1 Answers1

1

You have use the "New" button in the upper left corner, select Android Application Project, choose the name, icon...

When you have done, you should have a working "Hello world" app.

If you want to add external libraries this is the answer: https://stackoverflow.com/a/3643015/3203988

Community
  • 1
  • 1
MattButtMatt
  • 461
  • 2
  • 11
  • 26