Creating Android tests broken in 107.18?

I must be doing something wrong because I can't get IntelliJ to generate Android tests. These are the steps I'm following from scratch:

From the welcome page, select Create New Project. Create project from scratch. Name it 'TestTesting' and the location is C:\projects\TestTesting. Project file format is .idea. Uncheck Create Module. Finish.

In Project Structure, create a Module from scratch. Name it 'TestTestingApp'. Content root and Module file location are both C:\Projects\TestTesting\TestTestingApp. Select 'Android Module' as the type. Leave Create source directory selected and leave the relative path 'src'.

Set the Android SDK to 'Android 2.1-update1 Google APIs'. Leave 'Create default Android application structure' checked. Project properties is 'Application', Application name is 'TestTestingApp', Package name is 'com.rogerheim.testtesting. Uncheck 'Create Hello World' activity. Finish.

Under Project Settings set the Project SDK to 'Android 2.1-update1 Google APIs' and check Project language level to 6.0. Click OK and answer yes to the Language Level Changed prompt.

In the newly created module, open AndroidManifest.xml. Within the <manifest> tag add: <uses-sdk android:targetSdkVersion="7"> (NB: shouldn't the manifest template add this automatically? I think so.)

Under src/packagename add a new Activity component. Name it StartActivity with no label. Mark it as the startup activity.

Under res add a 'layout' directory and within layout add a new Layout resource file. Name it start_activity.xml. Accept the default root tags.

Back in StartActivity.java add: setContentView(R.layout.start_activity); directoy under the super.onCreate(savedInstanceState) line.

Build the project. It should build without error.

Create a new Run/Debug Configuration. Name it TestTestingApp, set the Module to TestTestingApp and leave the rest at the default. Run it; it should run without error on an emulator or device running 2.1 or better.

So far so good. Now go back into Project Structure and create a new module. Create from scratch, name it TestTestingTests. Content root and Module file location are C:\Projects\TestTesting\TestTestingTests. Select Android as the type. Create source directory named 'src'. Android SDK should be Android 2.1-update1 Google APIs, Create default Android application structure. Project properties is 'Test' and Tested module should be 'TestTestingApp.' Finish.

Click OK. Answer Yes to create a run configuration for module TestTestingTests.

Observed: Android Console contains:
  Found main project package: com.rogerheim.testtesting
  Found main project activity: .StartActivity
  Error: Unable to load the main project's default.properties
  The project wasn't generated by 'android' tool.

Also Observed: TestTestingTests module contains an empty 'src' folder and a TestTestingTests.iml file. Nothing else.

Also Observed: The TestTestingTests run configuration is created but it is invalid because the AndroidManifest.xml file doesn't exist.

This is on Windows 7 64bit. I haven't tried it yet on Ubuntu 10.10.

Edit: I tried it on Ubuntu and it does the same thing but I looked at the source to the Android plugin and I think I figured out what is going on. In AndroidModuleBuilder.java if the option to include the Hello World activity is checked the code calls 'createProjectByAndroidTool()' which calls out to the Android sdk to do the heavy lifting of creating the project structure. If the option to include the Hello World activity is *not* checked, AndroidModuleBuilder.java creates the project using internal methods and templates which, apparently, need updating.

1 comment
Comment actions Permalink

Thank you, Roger. I've created a related issue. Please, vote.

0

Please sign in to leave a comment.