本帖最后由 zhq56030207 于 2010-12-24 18:52:38 编辑

解决方案 »

  1.   

    导入的这个包是否存在,LaunchPerformanceBase的父类是什么,是不是activity.
      

  2.   

    // Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://kpdus.tripod.com/jad.html
    // Decompiler options: packimports(3) 
    // Source File Name:   LaunchPerformanceBase.javapackage android.test;import android.app.Instrumentation;
    import android.content.Intent;
    import android.os.*;
    import android.view.IWindowManager;public class LaunchPerformanceBase extends Instrumentation
    {    public LaunchPerformanceBase()
        {
            mResults = new Bundle();
            mIntent = new Intent("android.intent.action.MAIN");
            mIntent.setLaunchFlags(4);
            mWindowManager = android.view.IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
        }    protected void LaunchApp()
        {
            long start = 0L;
            long end = 0L;
            try
            {
                mWindowManager.setAnimationScale(0.0F);
            }
            catch(DeadObjectException e) { }
            if(!isProfiling())
            {
                startAllocCounting();
                start = System.currentTimeMillis();
            }
            startActivitySync(mIntent);
            waitForIdleSync();
            if(!isProfiling())
            {
                end = System.currentTimeMillis();
                stopAllocCounting();
                mResults.putLong("time", Long.valueOf(end - start));
                getAllocCounts(mResults);
            }
            try
            {
                mWindowManager.setAnimationScale(1.0F);
            }
            catch(DeadObjectException e) { }
        }    public static final String LOG_TAG = "Launch Performance";
        protected Bundle mResults;
        protected Intent mIntent;
        private IWindowManager mWindowManager;
    }有这个class吧?
    manifest中设置了测试可以参考这个教程,不知楼主看过了没。
    Android单元测试
    关键字: camera unit test 
    http://mintelong.javaeye.com/blog/460903
      

  3.   

       1. package com.android.camera;  
       2.   
       3. import android.app.Activity;  
       4. import android.os.Bundle;  
       5. import android.test.LaunchPerformanceBase;  
       6.   
       7. /** 
       8.  * Instrumentation class for Camera launch performance testing. 
       9.  */  
      10. public class CameraLaunchPerformance extends LaunchPerformanceBase {  
      11.   
      12.     public static final String LOG_TAG = "CameraLaunchPerformance";  
      13.   
      14.     public CameraLaunchPerformance() {  
      15.         super();  
      16.     }  
      17.   
      18.     @Override  
      19.     public void onCreate(Bundle arguments) {  
      20.         super.onCreate(arguments);  
      21.   
      22.         mIntent.setClassName(getTargetContext(), "com.android.camera.Camera");  
      23.         start();  
      24.     }  
      25.   
      26.     /** 
      27.      * Calls LaunchApp and finish. 
      28.      */  
      29.     @Override  
      30.     public void onStart() {  
      31.         super.onStart();  
      32.         LaunchApp();  
      33.         finish(Activity.RESULT_OK, mResults);  
      34.     }  
      35. }  
    红色部分报错~~~
      

  4.   

    Intent mIntent=new Intent();
     mIntent.setClassName(getTargetContext(), "com.android.camera.Camera");   就ok了
     但是
    LaunchApp();  
    finish(Activity.RESULT_OK, mResults); 
      这个该怎么办?
      

  5.   

    现在出现的问题是 No tests found with test runner 'JUnit 3'该怎么解决呢?