Android source using maven-android-plugin

1.1k views Asked by At

I'm using the maven-android-plugin to build my application, and I love it.

One thing that's confusing to me is the android sources.jar file that it comes with. If I examine InstrumentationTestRunner in android-1.5_r4-sources.jar, to pick a random example, it looks like:

package android.test;
public class InstrumentationTestRunner
  extends android.app.Instrumentation
  implements android.test.TestSuiteProvider
{
public  InstrumentationTestRunner() { throw new RuntimeException("Stub!"); }
public  void onCreate(android.os.Bundle arguments) { throw new RuntimeException("Stub!"); }
protected  android.test.AndroidTestRunner getAndroidTestRunner() { throw new RuntimeException("Stub!"); }
public  void onStart() { throw new RuntimeException("Stub!"); }
public  junit.framework.TestSuite getTestSuite() { throw new RuntimeException("Stub!"); }
public  junit.framework.TestSuite getAllTests() { throw new RuntimeException("Stub!"); }
public  java.lang.ClassLoader getLoader() { throw new RuntimeException("Stub!"); }
public static final java.lang.String REPORT_VALUE_ID = "InstrumentationTestRunner";
public static final java.lang.String REPORT_KEY_NUM_TOTAL = "numtests";
public static final java.lang.String REPORT_KEY_NUM_CURRENT = "current";
public static final java.lang.String REPORT_KEY_NAME_CLASS = "class";
public static final java.lang.String REPORT_KEY_NAME_TEST = "test";
public static final int REPORT_VALUE_RESULT_START = 1;
public static final int REPORT_VALUE_RESULT_OK = 0;
public static final int REPORT_VALUE_RESULT_ERROR = -1;
public static final int REPORT_VALUE_RESULT_FAILURE = -2;
public static final java.lang.String REPORT_KEY_STACK = "stack";
}

Which isn't very useful and clearly isn't the actual source code, which looks like this.

My pom looks like the following:

<dependencies>
    ...
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>1.5_r4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Is there a way to get the ACTUAL android sources from the maven-android-plugin to aid in debugging?

1

There are 1 answers

0
Manfred Moser On

There is a project in the works that is looking at this https://github.com/joakime/android-sdkfido. The reason the android jar in central is the stubbed jar is that we needed to be comparable to the actual jar from the sdk, which is stubbed as well. This was necessary to be allowed to publish into central under the google namespace.