Android源码使用maven-android-plugin

时间:2011-02-14 17:16:37

标签: android maven android-maven-plugin

我正在使用maven-android-plugin构建我的应用程序,我喜欢它。

令我困惑的一件事是它附带的android sources.jar文件。如果我在InstrumentationTestRunner中检查android-1.5_r4-sources.jar,请选择一个随机示例,它看起来像:

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";
}

哪个不是很有用,显然不是实际的源代码,它看起来像like this

我的pom如下所示:

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

有没有办法从maven-android-plugin获取ACTUAL android源来帮助调试?

1 个答案:

答案 0 :(得分:1)

有一个项目正在研究这个https://github.com/joakime/android-sdkfido。中心的android jar是存根jar的原因是我们需要与sdk中的实际jar相媲美,sdk也是存根的。这是必要的,允许在google命名空间下发布到中心。