iRSSの日記

はてなダイアリーiRSSの日記の続き

Test run failed: Unable to find instrumentation target package:にしばし悩む

[2010-01-16 19:41:05 - RecruitMtlViewTest]Test run failed: Unable to find instrumentation target package: jp.co.recruit.mtl.android.view

Test run failed: Unable to find instrumentation target package:がでてテストができなくなった。
下記エントリで、「adb shell pm list package 」を使って、対象のパッケージがあるかどうか確認して見なさいというアドバイスがあった

I believe you'll get this error message if there is no Android app
with package name "com.android.abc.providers" installed on the device.
Without more context it will be difficult to diagnose your problem.
You can use this command "adb shell pm list packages" to retrieve the
list of packages installed on the device.

Are your tests included in the app with packageName
"com.android.abc.providers", or is that a separate application?

jp.co.recruit.mtl.android.viewがないのが問題なので、以下のコマンドでチェック

$ adb shell pm list package | grep mtl
package:jp.co.recruit.mtl.android.view.sample
package:jp.co.recruit.mtl.android.view.test

たしかにjp.co.recruit.mtl.android.viewがない

テストされる側の、マニュフェストが間違っていた。テストされる側にも確認用に、Activityを用意していたのだか、そのActivityが入っている、パッケージを指定していた。

修正前

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	  package="jp.co.recruit.mtl.android.view.sample"
	  android:versionCode="1"
	  android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".RecruitMtlActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="3" />
	<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest> 

修正後

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	  package="jp.co.recruit.mtl.android.view"
	  android:versionCode="1"
	  android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".sample.RecruitMtlActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="3" />
	<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest> 


解決したー
すっきり。

でも、つかれたー。