Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load the main project's project.properties in android studio while creating a test project using terminal

I am trying to create a Test Project for a simple application project called 'SimpleMaths' in android studio. As per the android documentation for Testing from Other IDEs i used a command android create test-project -m <main_path> -n <project_name> -p <test_path> to create a test project. Specific to my project i have following project directory and command used:

Project Directory:

F:\Projects\SimpleMaths

command used to create SimpleMathsTest:

android create test-project -m ../main -n SimpleMathsTest -p F:\Projects\SimpleMaths\app\src\main 

After this command is run:

In windows cmd:

C:\Program Files (x86)\Android\android-studio\sdk\tools>android create test-project -m ../main -n SimpleMathsTest -p F:\Projects\SimpleMaths\app\src\main

Found main project package: simplemaths.app

Found main project activity: .MainActivity

Error: Unable to load the main project's project.properties

In Android Studio's terminal

F:\Projects\SimpleMaths\app\src>android create test-project -m ../main -p main

Found main project package: simplemaths.app

Found main project activity: .MainActivity 

Error: Unable to load the main project's project.properties

What could be the problem and how to generate such test projects with proper structure in android studio?

like image 806
user3300094 Avatar asked Dec 07 '25 23:12

user3300094


1 Answers

From Gradle Plugin user Guide-Testing

Building a test application is integrated into the application project.

So see the documentation above for more informations.

In fact, you don't have to create any test project under Android Studio. They are automatically "included" in you application project.

So what you have to do is to create a test folder, create your tests in and run them (sounds easy, but it took me more time then I thought it would because of all documetation you can find).

I'm very new in Andtoid testing so I can't respond to this:

What could be the problem

but here what I have done which worked for me:

  1. Under my src/main/java/ I created androidTest/java package.

  2. Created my tests in.

  3. in Run->Edit configurations I created an "Android Tests" configuration where I informed my Module and chose location of my tests.

In first time that didn't work, so I ran one of them manually (right click on it->run) and the reran my "Android Tests configuration" and it worked fine for me.

like image 162
kelevra Avatar answered Dec 09 '25 13:12

kelevra