Android Mock for Gingerbread

89 views
Skip to first unread message

stefano

unread,
Jan 14, 2011, 9:27:46 AM1/14/11
to Android Mock Discussion
Hi!
Are you going to release a version that supports Gignerbread anytime
soon? I really look forward to using Android Mock but we recently
upgraded our projects to 2.3 so we cannot use it for now. Besides
that, is anyone using Android Mock on a build server?

Thanks!

Stephen Woodward

unread,
Jan 19, 2011, 2:32:05 AM1/19/11
to androi...@googlegroups.com

I had hoped to do it last weekend but I'm quite busy as of late. I'll try to do it soon.

Stephen Woodward

unread,
Jan 23, 2011, 12:58:59 PM1/23/11
to androi...@googlegroups.com

I've now added gingerbread support for Android mock. I haven't given it a live test yet, though, but I won't have time for at least a week or two to do so. I wanted to at least get something up for people to try using.

If you encounter any issues please let me know.

Thanks,

Steve

Fred Grott

unread,
Jan 23, 2011, 3:12:13 PM1/23/11
to androi...@googlegroups.com
Thanks, Steve we appreciate your hard work.


Fred Grott
Developer(Android, Mobile Convergence, LAMP, Enterprise Java)
About.me Profile:
http://about.me/fredgrott
Main Profile, Demos, Slides, etc: http://shareme.github.com
blog:
Resume/CV Profile:
http://www.linkedin.com/in/shareme







Fred Grott
Android Developer
http://mobilebytes.wordpress.com 

stefano

unread,
Feb 9, 2011, 4:32:59 PM2/9/11
to Android Mock Discussion
Thanks Stephen! I'll try it asap.

On Jan 23, 6:58 pm, Stephen Woodward <sd.woodwar...@googlemail.com>
wrote:
> I've now added gingerbread support for Android mock. I haven't given it a
> live test yet, though, but I won't have time for at least a week or two to
> do so. I wanted to at least get something up for people to try using.
>
> If you encounter any issues please let me know.
>
> Thanks,
>
> Steve
>  On Jan 19, 2011 7:32 AM, "Stephen Woodward" <sd.woodwar...@googlemail.com>
> wrote:
>
> > I had hoped to do it last weekend but I'm quite busy as of late. I'll try
> to
> > do it soon.

stefano

unread,
Feb 17, 2011, 6:07:24 AM2/17/11
to Android Mock Discussion
Hi Stephen,
I tried it but it did not work for me, I hope you can help me. My
first doubt is on the project configuration: where should one add the
AndroidMockRuntime.jar file? If you read the "Setting Up Android Mock
in Eclipse" PDF it is never mentioned, so I am not sure if/where I
have to use it. I had some more issues but first I want to be sure I
have the right set-up before asking.

Thanks!


On 23 Jan., 18:58, Stephen Woodward <sd.woodwar...@googlemail.com>
wrote:
> I've now added gingerbread support for Android mock. I haven't given it a
> live test yet, though, but I won't have time for at least a week or two to
> do so. I wanted to at least get something up for people to try using.
>
> If you encounter any issues please let me know.
>
> Thanks,
>
> Steve
>  On Jan 19, 2011 7:32 AM, "Stephen Woodward" <sd.woodwar...@googlemail.com>
> wrote:
>
> > I had hoped to do it last weekend but I'm quite busy as of late. I'll try
> to
> > do it soon.

Stephen Woodward

unread,
Feb 17, 2011, 3:58:59 PM2/17/11
to androi...@googlegroups.com
Sorry about the missing docs.  I sent out an email around early November to the discussion list about the new setup, but I haven't had time to update the documentation appropriately.  See here and if you still have questions, please let me know: https://groups.google.com/group/android-mock/browse_thread/thread/72b2d3e915c63d0c?hl=en

Thanks,

Steve

stefano

unread,
Feb 19, 2011, 11:54:25 AM2/19/11
to Android Mock Discussion
I was aware of that email but my doubts are still there, I'll try to
resume the set-up process, please tell me if I am doing something
wrong. In my test project I must:
- ensure that the Java 1.6 compiler is used and enable the annotation
processing and add the two new keys.
- add the AndroidMockGenerator.jar as a project dependency.
- add the AndroidMockGenerator.jar as an external jar to the factory
path together with the android jar, the android_framework_mocks.jar,
and add the path to my app's bin folder and any other external library
I'd like to mock.

So is the AndroidMockRuntime jar useless or I am missing something?
Thanks for the support!

On Feb 17, 9:58 pm, Stephen Woodward <sd.woodwar...@googlemail.com>
wrote:
> Sorry about the missing docs.  I sent out an email around early November to
> the discussion list about the new setup, but I haven't had time to update
> the documentation appropriately.  See here and if you still have questions,
> please let me know:https://groups.google.com/group/android-mock/browse_thread/thread/72b...
>
> Thanks,
>
> Steve
>
> On 17 February 2011 11:07, stefano <stefano.dacchi...@gmail.com> wrote:> Hi Stephen,

Stephen Woodward

unread,
Feb 19, 2011, 12:28:29 PM2/19/11
to androi...@googlegroups.com

One correction...

On Feb 19, 2011 4:54 PM, "stefano" <stefano....@gmail.com> wrote:
>
> I was aware of that email but my doubts are still there, I'll try to
> resume the set-up process, please tell me if I am doing something
> wrong. In my test project I must:
> - ensure that the Java 1.6 compiler is used and enable the annotation
> processing and add the two new keys.
> - add the AndroidMockGenerator.jar as a project dependency.

Use AndroidMockRuntime.jar as the project dependency.

Stephen Woodward

unread,
Feb 19, 2011, 12:29:28 PM2/19/11
to androi...@googlegroups.com

If that doesn't get you going, please send me the annotation processor log file.

stefano

unread,
Feb 20, 2011, 7:12:02 PM2/20/11
to Android Mock Discussion
I will. Thanks again Stephen!

On Feb 19, 6:29 pm, Stephen Woodward <sd.woodwar...@googlemail.com>
wrote:
> If that doesn't get you going, please send me the annotation processor log
> file.
> On Feb 19, 2011 5:28 PM, "Stephen Woodward" <sd.woodwar...@googlemail.com>
> wrote:
>
>
>
> > One correction...

Justin Pincar

unread,
Mar 24, 2011, 7:59:13 PM3/24/11
to Android Mock Discussion
I think I might be having a similar issue. When I try to add
AndroidMockRuntime.jar to my build path, I get a "Conversion to Dalvik
format failed with error 1". I don't get this error when using
AndroidMockGenerator.jar, but then I get "java.lang.RuntimeException:
Could not find mock for java.lang.Object -- Make sure to run the
MockGenerator.jar on your test jar, and to build the Android test APK
using the modified jar created by MockGenerator"". Any pointers?
- Justin


[2011-03-24 16:49:02 - android-ads-demo]: Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/android/
testing/mocking/AndroidFrameworkMockGenerator;
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:
123)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main.processClass(Main.java:372)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main.access$400(Main.java:59)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:
244)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
130)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:
108)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main.processOne(Main.java:313)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.dx.command.dexer.Main.run(Main.java:185)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
java.lang.reflect.Method.invoke(Method.java:597)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.ide.eclipse.adt.internal.build.DexWrapper.run(Unknown
Source)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(Unknown
Source)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(Unknown
Source)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:
627)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
170)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
201)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:
253)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
256)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:
309)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:
341)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:
140)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:
238)
[2011-03-24 16:49:02 - android-ads-demo]: Dx at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
[2011-03-24 16:49:02 - android-ads-demo]: Dx1 error; aborting
[2011-03-24 16:49:02 - android-ads-demo] Conversion to Dalvik format
failed with error 1


On Feb 19, 10:28 am, Stephen Woodward <sd.woodwar...@googlemail.com>
wrote:
> One correction...

Araceli Checa

unread,
Mar 25, 2011, 6:47:42 AM3/25/11
to androi...@googlegroups.com, Justin Pincar
Hi Justin,

The error you are seeing is because the AndroidMockRuntime.jar is being passed twice to dex, and that is not supported (see bug #4126561)

Are you seeing this error in a blaze build? ant? eclipse? It you give us more info we might be able to help you.

Cheers,
  Araceli
  http://go/OnlyCheckEmailTwiceADay - for quick responses, please use G.Talk



--
You received this message because you are subscribed to the Google Groups "Mobile Build-Tools Team" group.
To post to this group, send email to mobile-bu...@google.com.
To unsubscribe from this group, send email to mobile-build-to...@google.com.
For more options, visit this group at http://groups.google.com/a/google.com/group/mobile-build-tools/?hl=en.


Justin Pincar

unread,
Mar 25, 2011, 1:16:35 PM3/25/11
to Araceli Checa, androi...@googlegroups.com
I followed the eclipse instructions to the letter in the (8mo old)
documentation. That didn't work at all, so I searched around on this
group and found this thread, and after more tweaks the log now shows
that I'm generating and saving the mocks. A check in my test project's
bin/ folder shows a bunch of created directories with names like
"v15/genmocks." When I run it I get the errors I noted in my initial
email. What other information would be helpful?
- Justin
Reply all
Reply to author
Forward
Message has been deleted
0 new messages