2011-02-14 79 views
3

我使用maven-android-plugin来构建我的应用程序,并且我喜欢它。使用maven-android-plugin的Android源代码

有一件事让我感到困惑的是它附带的android sources.jar文件。如果我检查android-1.5_r4-sources.jarInstrumentationTestRunner,挑随便举个例子,它看起来像:

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的插件的实际的Android源来帮助调试?

回答

1

在看这个https://github.com/joakime/android-sdkfido的作品中有一个项目。中央机器人jar的原因是stubbed jar是我们需要与sdk中的实际jar相媲美,它也是stubbed。这是必要的,允许发布到谷歌名称空间中央。