Home Features Docs Blog Support GitHub

moeTest can't find MoeRemoteTestRunner.main

(Matt Cosand) #1

I’m trying to add JUnit tests to an existing multi-os-engine project (SDK 1.4.2)

When I run ./gradlew moeTest -Pmoe.launcher.devices=XXXX I see the app launch on the device and then quickly exit. In the terminal or reports/txt log file I find:

art I  2280 688238 /Users/rolandvigh/public-repo/aosp/art/runtime/parsed_options.cc:449] setting boot class path to /var/containers/Bundle/Application/<MY-GUID>/MyApp-Test.app/application.jar:/var/containers/Bundle/Application/<MY-GUID>/MyApp-Test.app
/Users/rolandvigh/public-repo/moe/natj/natj/src/main/native/natj/NatJ.cpp:353 DEBUG: Method 'boolean java.lang.reflect.Method.isDefault()' is not accessible.
Unable to find static main(String[]) in 'org/moe/mdt/junit/MoeRemoteTestRunner'
java.lang.NoSuchMethodError: no static method "Lorg/moe/mdt/junit/MoeRemoteTestRunner;.main([Ljava/lang/String;)V"
java.lang.NoSuchMethodError: no static method "Lorg/moe/mdt/junit/MoeRemoteTestRunner;.main([Ljava/lang/String;)V"

How should I get this class on the device?

(Matt Cosand) #2

Found that someone had commented out the proguard rule

-keepclasseswithmembers public class * {
    public static void main(java.lang.String[]);

Adding the line

-keep class org.moe.mdt.junit.** { *; }

gets the tests running on the device.