ChanGan
ChanGan

Reputation: 4318

How to resolve java.lang.nullpointer exception in android test project?

In Eclipse i am doing to create a Android Test Project in the below way. But I am getting always java.lang.NullpointerException.

Procedure. No Previous project is there on the eclipse.

Select New --> Project --> Android -->Android Test Project.

It is asking project name. I am giving test. Then it is asking android version. I am selecting android 2.2 now i am selecting ok. i am getting "java.lang.NullpointerException"

How to resolve this?

Upvotes: 1

Views: 3467

Answers (5)

jasonflaherty
jasonflaherty

Reputation: 1944

I found this error creating a phonegap app. If you click the TEST app also, then click finish then Cancel, it works fine... Strange...

Upvotes: 0

bradreaves
bradreaves

Reputation: 1483

I had this same error when choosing "This project" in the "Select Test Target" dialog. This option is necessary for me because I am trying to use Robotium to test a pre-packaged APK.

To fix the error, I added a dummy Android project, then created a test project and chose "This project."

Upvotes: 1

sky-dev
sky-dev

Reputation: 6258

The above answers are right on the money. Make sure you don't click 'Finish' prematurely before you make it to the 'TestTarget' page.

Upvotes: 1

Rajdeep Dua
Rajdeep Dua

Reputation: 11230

If you choose an existing Project to Test, it should work.

enter image description here

Upvotes: 1

Kristiono Setyadi
Kristiono Setyadi

Reputation: 5643

You should include another project within Test Project that indicates the project you want to test.

For example, you have a project named MyCompanyProject and suppose you want to create a test project for it. You can name it MyCompanyTestProject and you should refer to MyCompanyProject in the Test Target section when creating MyCompanyTestProject.

Upvotes: 1

Related Questions