我將ViewPagerIndicator
添加到我的項目(它是一個Android庫項目),我的測試在IntelliJ上運行良好,但是在從ANT運行它時失敗。要清楚的是,只有引用此Android庫項目的類的測試失敗,其餘的都沒有任何問題。我猜我的build.xml中有些東西是不正確的?其他人遇到這個?NoClassDefFoundError僅適用於運行ANT測試時的庫項目類
這裏的堆棧跟蹤:
java.lang.NoClassDefFoundError: Lcom/viewpagerindicator/CirclePageIndicator; com.google.inject.internal.util.$ComputationException: java.lang.NoClassDefFoundError: Lcom/viewpagerindicator/CirclePageIndicator; at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553) at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419) at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041) at com.google.inject.internal.FailableCache.get(FailableCache.java:50) at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:65) at com.google.inject.internal.InjectorImpl.getMembersInjector(InjectorImpl.java:950) at com.google.inject.internal.InjectorImpl.getMembersInjector(InjectorImpl.java:957) at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:943) at roboguice.inject.ContextScopedRoboInjector.injectMembersWithoutViews(ContextScopedRoboInjector.java:243) at roboguice.activity.RoboActivity.onCreate(RoboActivity.java:78) at com.mycompany.myproduct.activities.TutorialActivity.onCreate(TutorialActivity.java:36) at com.mycompany.myproduct.activities.TutorialActivityTest.setup(TutorialActivityTest.java:37) at com.xtremelabs.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:292)
添加'android.library.reference.1 =「路徑lib文件夾」在' ant.properties文件。 – Tarun
@Tarun我已經在我的project.properties文件中定義了它。 –
@Tarun如果你沒有進行自動構建,那麼工作正常。而且你不應該自己添加庫引用,這就是'android update project'的用處。 –