English 中文(简体)
与AndroidMock公司一起进行的蚂蚁和机器人试验项目
原标题:Ant android test project with AndroidMock
  • 时间:2012-05-25 09:24:53
  •  标签:
  • android
  • ant

我有一个机器人项目,我想 建造,安装和运行测试 用命令线。

以下是我的建筑外壳脚本:

android update project --path ./main/libraryProject
android update project --path ./main/Project --library ../libraryProject
android update project --path ./main/Test --library ../libraryProject
android update test-project -m $(pwd)/main/Project -p ./main/Test
cd main/Project
ant debug install
cd ../Test
ant debug install test

该项目可以建造和安装,但在建立测试项目时遇到以下错误:

    [javac] An annotation processor threw an uncaught exception.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.NoClassDefFoundError: android/app/Activity
    [javac]     at java.lang.ClassLoader.defineClass1(Native Method)
    [javac]     at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    [javac]     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    [javac]     at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    [javac]     at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    [javac]     at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    [javac]     at java.security.AccessController.doPrivileged(Native Method)
    [javac]     at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    [javac]     at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    [javac]     at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    [javac]     at java.lang.Class.forName0(Native Method)
    [javac]     at java.lang.Class.forName(Class.java:264)
    [javac]     at com.google.android.testing.mocking.UsesMocksProcessor.findClassesToMock(UsesMocksProcessor.java:144)
    [javac]     at com.google.android.testing.mocking.UsesMocksProcessor.process(UsesMocksProcessor.java:108)
    [javac]     at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:735)
    [javac]     at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:664)
    [javac]     at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:809)
    [javac]     at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1060)
    [javac]     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:795)
    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:380)
    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:306)
    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:297)
    [javac]     at com.sun.tools.javac.Main.compile(Main.java:82)
    [javac]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [javac]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    [javac]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [javac]     at java.lang.reflect.Method.invoke(Method.java:616)
    [javac]     at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
    [javac]     at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1153)
    [javac]     at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:930)
    [javac]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [javac]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    [javac]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [javac]     at java.lang.reflect.Method.invoke(Method.java:616)
    [javac]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [javac]     at org.apache.tools.ant.Task.perform(Task.java:348)
    [javac]     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    [javac]     at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
    [javac]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [javac]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    [javac]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [javac]     at java.lang.reflect.Method.invoke(Method.java:616)
    [javac]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [javac]     at org.apache.tools.ant.Task.perform(Task.java:348)
    [javac]     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    [javac]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [javac]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    [javac]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [javac]     at java.lang.reflect.Method.invoke(Method.java:616)
    [javac]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [javac]     at org.apache.tools.ant.Task.perform(Task.java:348)
    [javac]     at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
    [javac]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    [javac]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    [javac]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [javac]     at java.lang.reflect.Method.invoke(Method.java:616)
    [javac]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    [javac]     at org.apache.tools.ant.Task.perform(Task.java:348)
    [javac]     at org.apache.tools.ant.Target.execute(Target.java:392)
    [javac]     at org.apache.tools.ant.Target.performTasks(Target.java:413)
    [javac]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    [javac]     at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    [javac]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    [javac]     at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    [javac]     at org.apache.tools.ant.Main.runBuild(Main.java:811)
    [javac]     at org.apache.tools.ant.Main.startAnt(Main.java:217)
    [javac]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    [javac]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
    [javac] Caused by: java.lang.ClassNotFoundException: android.app.Activity
    [javac]     at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    [javac]     at java.security.AccessController.doPrivileged(Native Method)
    [javac]     at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    [javac]     at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    [javac]     at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    [javac]     ... 68 more

有尸体知道我该怎么做吗?

问题回答

您需要在要编译代码的类路径中添加类固醇罐。 您可以设置此选项来做到这一点 :

<property name="jar.libs.dir" value="${libs.dir}" />

然后可以删除编译后的内容 :

<target name="-post-compile">
    <delete file="libs/android.jar"> </delete>
</target>




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签