使用maven-android-plugin构建Android源代码

3
我正在使用maven-android-plugin来构建我的应用程序,我非常喜欢它。
有一件事让我感到困惑,那就是它附带的android sources.jar文件。例如,如果我检查android-1.5_r4-sources.jar中的InstrumentationTestRunner,它看起来像这样:
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";
}

这并不是很有用,显然也不是实际的源代码,实际的源代码看起来像这样

我的pom文件如下:

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

有没有一种方法可以从maven-android-plugin获取实际的Android源代码来帮助调试?
1个回答

1

目前有一个项目正在研究这个https://github.com/joakime/android-sdkfido。中央仓库中的 Android jar 是存根 jar 的原因是我们需要与 sdk 中的实际 jar 兼容,而该 jar 也是存根的。这是为了允许在 Google 命名空间下发布到中央仓库。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接