It worked, except I got an IllegalAccessError from the dex pre-verifier at runtime since I swapped out a class (see below). Basically I'm linking against one and then replacing it with another which technically matches the API. Doing the aforementioned Jar trick to the same effect yields the same result.
Original for linking: https://code.google.com/p/android-test-kit/source/browse/testrunner/src/main/java/com/google/android/apps/common/testing/testrunner/hidden/ExposedInstrumentationApi.java#17 Swapped for runtime: https://code.google.com/p/android-test-kit/source/browse/testrunner-runtime/src/main/java/ExposedInstrumentationApi.java The comment mentions "neverlink". Is that a component of your internal build system? I haven't tried doing the same thing with Maven yet, but since Espresso seems to use that I'll give it a go. Class resolved by unexpected DEX: Lcom/google/android/apps/common/testing/ui/espresso/contrib/test/DrawerActivity;(0xa4fcc2b0):0x96590000 ref [Landroid/support/v4/widget/DrawerLayout;] Landroid/support/v4/widget/DrawerLayout;(0xa4fcc2b0):0x966e3000 (Lcom/google/android/apps/common/testing/ui/espresso/contrib/test/DrawerActivity; had used a different Landroid/support/v4/widget/DrawerLayout; during pre-verification) Shutting down VM threadid=1: thread exiting with uncaught exception (group=0xa4cf3b20) FATAL EXCEPTION: main Process: com.google.android.apps.common.testing.ui.espresso.contrib.test, PID: 6850 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation at com.google.android.apps.common.testing.ui.espresso.contrib.test.DrawerActivity.onCreate(DrawerActivity.java:35) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at com.google.android.apps.common.testing.testrunner.GoogleInstrumentation.callActivityOnCreate(GoogleInstrumentation.java:428) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Shutting down VM --- Jake Wharton http://about.me/jakewharton On Thu, Jan 30, 2014 at 9:15 PM, Xavier Ducrohet <[email protected]> wrote: > There's a provided scope since 0.8.0 though to be honest, I'm not 100% > sure it's properly handled by the library projects. I'll double check > tomorrow. > > > On Thu, Jan 30, 2014 at 9:03 PM, Jake Wharton <[email protected]>wrote: > >> Ok so I've had a chance to slow down since I was bouncing all over the >> place... >> >> The aar obviously has a classes.jar, not a classes.dex. What needs >> changed is the non-exposed Jar task that assemble depends on. What I'm >> doing doesn't really require longevity so I'll just find it by task name >> and make the necessary adjustments for now. >> >> I haven't figured out if there's value in something like this for the >> long term. >> >> >> --- >> Jake Wharton >> http://about.me/jakewharton >> >> >> On Thu, Jan 30, 2014 at 7:25 PM, Jake Wharton <[email protected]>wrote: >> >>> Basically the equivalent of a provided dependency but with classes in >>> the module. >>> >>> I initially tried: >>> >>> android.libraryVariants.all { variant -> >>> variant.assemble.excludes << '**/gtfo/*' >>> } >>> >>> But immediately realized it's being embedded in the dex so this has no >>> effect. >>> >>> dx itself doesn't seem to have any way to filter but the invocation of >>> it (in AndroidBuilder.convertByteCode) expands the input dir into a >>> list of absolute file paths. >>> >>> Would you be open to adding an excludes list of globs on the Dex task? >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "adt-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Xavier Ducrohet > Android SDK Tech Lead > Google Inc. > http://developer.android.com | http://tools.android.com > > Please do not send me questions directly. Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
