Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7840311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:44:17+00:00 2026-06-02T15:44:17+00:00

My question is: How do I create an Android stand-alone test project for an

  • 0

My question is: How do I create an Android stand-alone test project for an Android library?

I’ve got my Android library (which is marked as “Library” in the project settings) and an Android project containing my JUnit test classes. The test project correctly references the Android library (in the project settings under “Android”).

My library source code is located in the package com.mayastudios. All my test cases are also located in the same package (but in a different project). So basically I have something like this:

+- MyLibraryProject
   +- src
      +- com/mayastudios/MyClass.java
   +- AndroidManifest.xml
   +- ...
+- MyTestProject (references MyLibraryProject)
   +- test
      +- com/mayastudios/MyClassTests.java
   +- AndroidManifest.xml
   +- ...

Here’s the Android manifest for the test project:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.spatialite.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.mayastudios" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <application android:label="Spatialite-NewApi-UnitTests">
        <uses-library android:name="android.test.runner" />
    </application>

</manifest>

However, when I run the test project (from Eclipse with ADT, using “Run As -> Android JUnit Test”) I get the following error:

Unable to find instrumentation target package: com.mayastudios

Here’s the complete Console log:

[2012-04-24 17:24:20 - spatialite-test] Android Launch!
[2012-04-24 17:24:20 - spatialite-test] adb is running normally.
[2012-04-24 17:24:20 - spatialite-test] Performing android.test.InstrumentationTestRunner JUnit launch
[2012-04-24 17:24:20 - spatialite-test] Automatic Target Mode: using device '3732FBC2711300EC'
[2012-04-24 17:24:20 - spatialite-test] Uploading spatialite-test.apk onto device '3732FBC2711300EC'
[2012-04-24 17:24:20 - spatialite-test] Installing spatialite-test.apk...
[2012-04-24 17:24:22 - spatialite-test] Success!
[2012-04-24 17:24:22 - spatialite-test] Launching instrumentation android.test.InstrumentationTestRunner on device 3732FBC2711300EC
[2012-04-24 17:24:22 - spatialite-test] Collecting test information
[2012-04-24 17:24:23 - spatialite-test] Test run failed: Unable to find instrumentation target package: com.mayastudios

I tried to remove the <instrumentation> tag from the manifest which didn’t work.

The only way I got this working so far was to create a default Android project (with an Activity), reference it from my test project and use the package name of this default Android project as targetPackage under <instrumentation>. But that’s not what I want. I want a stand-alone test project.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:44:18+00:00Added an answer on June 2, 2026 at 3:44 pm

    Ah, the answer is so simple. The error is in the Android manifest of the test project in line 3: Here the wrong package is mentioned. So the corrected manifest looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.mayastudios"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk android:minSdkVersion="10" />
    
        <instrumentation
            android:name="android.test.InstrumentationTestRunner"
            android:targetPackage="com.mayastudios" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    
        <application android:label="Spatialite-NewApi-UnitTests">
            <uses-library android:name="android.test.runner" />
        </application>
    
    </manifest>
    

    And to all who say that you need three projects (library, project-under-test, test project): They’re wrong. A library project and a test project are enough. The test project doesn’t even need to contain an Activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I create an Android library project in NetBeans IDE? The build target
How do I create an Android Test project in Eclipse in the target project's
I have a question regarding how to obfuscate an Android library project. Overall, I'd
i got a question when create a javascript object, when one function invoking another
Question How do you procedurally create a function in Python which takes specific named
The fundamental question is how do I create a unit test that needs to
Im an Android noob, coming from objC, I have a very stupid question (project
basic question - I'm still learning Android - trying to create a seperate thread
I am trying to create an application in Android 2.2 which sends SMS to
I am new in android world. When I create a project while setting Target

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.