android.view.InflateException: XML file build/intermediates/res/merged/debug/layout/activity_360_video.xml line #-1 (sorry, not yet implemented): Error inflating class com.google.vr.sdk.base.GvrView
dependencies {
...
//Google Cardboard
compile project(':cardboardsdk:base')
compile project(':cardboardsdk:common')
}
我不清楚是否因为robolectric还没有完成一些必要的实现而不可能使用robolectric来扩展这个视图,或者我只是没有正确地连接所有的东西。
我尝试将依赖项添加到测试中,如下所述:
@Config(libraries = {
"build/intermediates/exploded-aar/<Project name>.cardboardsdk/base/1.0.0",
"build/intermediates/exploded-aar/<Project name>.cardboardsdk/common/1.0.0"
})
但这没有效果。
完整测试类:
@Config(libraries = {
"build/intermediates/exploded-aar/<Project name>.cardboardsdk/base/1.0.0",
"build/intermediates/exploded-aar/<Project name>.cardboardsdk/common/1.0.0"
})
public class Activity360VideoTest extends PowerRoboTest {
Activity activity;
@Before
public void setup() {
activity = Robolectric.buildActivity(Activity360Video.class).create().get();
}
@Test
public void test() {
assertNotNull(activity);
}
}
和堆栈跟踪:
android.view.InflateException: XML file build/intermediates/res/merged/debug/layout/activity_360_video.xml line #-1 (sorry, not yet implemented): Error inflating class com.google.vr.sdk.base.GvrView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at <package>.Activity360Video.onCreate(Activity360Video.java:52)
at android.app.Activity.performCreate(Activity.java:5933)
at org.robolectric.util.ReflectionHelpers.callInstanceMethod(ReflectionHelpers.java:195)
at org.robolectric.util.ActivityController$1.run(ActivityController.java:126)
at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:340)
at org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:40)
at org.robolectric.util.ActivityController.create(ActivityController.java:123)
at org.robolectric.util.ActivityController.create(ActivityController.java:133)
at <package>.Activity360VideoTest.setup(Activity360VideoTest.java:25)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:250)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:176)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:142)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$2.call(DelegatingPowerMockRunner.java:146)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$2.call(DelegatingPowerMockRunner.java:139)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.withContextClassLoader(DelegatingPowerMockRunner.java:130)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.run(DelegatingPowerMockRunner.java:139)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:106)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at android.view.LayoutInflater.$$robo$$createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createView(LayoutInflater.java)
at android.view.LayoutInflater.$$robo$$createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.$$robo$$rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.$$robo$$rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.$$robo$$inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.$$robo$$inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.$$robo$$inflate(LayoutInflater.java:365)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.support.v7.app.AppCompatDelegateImplV9.$$robo$$setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java)
at android.support.v7.app.AppCompatActivity.$$robo$$setContentView(AppCompatActivity.java:140)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java)
at <package>.Activity360Video.onCreate(Activity360Video.java:52)
at android.app.Activity.$$robo$$performCreate(Activity.java:5933)
at android.app.Activity.performCreate(Activity.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.robolectric.util.ReflectionHelpers.callInstanceMethod(ReflectionHelpers.java:195)
at org.robolectric.util.ActivityController$1.run(ActivityController.java:126)
at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:340)
at org.robolectric.shadows.CoreShadowsAdapter$2.runPaused(CoreShadowsAdapter.java:40)
at org.robolectric.util.ActivityController.create(ActivityController.java:123)
at org.robolectric.util.ActivityController.create(ActivityController.java:133)
at <package>.Activity360VideoTest.setup(Activity360VideoTest.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:250)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:176)
at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:142)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$2.call(DelegatingPowerMockRunner.java:146)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner$2.call(DelegatingPowerMockRunner.java:139)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.withContextClassLoader(DelegatingPowerMockRunner.java:130)
at org.powermock.modules.junit4.internal.impl.DelegatingPowerMockRunner.run(DelegatingPowerMockRunner.java:139)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:106)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
... 1 more
Caused by: java.lang.UnsatisfiedLinkError: no gvrbase in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.google.vr.sdk.base.CardboardViewNativeImpl.<init>(CardboardViewNativeImpl.java:98)
at com.google.vr.sdk.base.ImplementationSelector.createCardboardViewApi(ImplementationSelector.java:34)
at com.google.vr.sdk.base.GvrView.init(GvrView.java:764)
at com.google.vr.sdk.base.GvrView.<init>(GvrView.java:255)
... 71 more
看起来GvrView在静态初始化器中加载libgvrbase.so,但这在Robolectric中失败了。
请参见:Robolectric对加载JNI库的应用程序对象进行坦克处理。我能找个变通办法吗?
和:https://github.com/robolectric/robolectric/issues/1171
问题内容: 我有两个项目,并且属于该小组。取决于。 为了能够在不依赖外部服务的情况下开发应用程序的UI部分,在其中实现了虚拟DAO (它们返回静态数据,因此我们不必连接到数据库等)。 我们被要求将虚拟类移至。这意味着他们不会被部署到从Web项目构建的战争中。我在maven网站上找到了 这些说明 ,但它们似乎对我不起作用。 在中,我有: 在上运行时,在目标中,我会得到两个jar:和。它们都可以很好地
null build.gradle 沉降。gradle src/ 在中,我希望将添加为依赖项: 不幸的是,我总是收到这样的错误消息: 我想知道我做错了什么,为什么显然没有很多其他人有同样的问题。如果有提示我会很感激的。 注意:这不是一个Android项目。
我正在开发一个Java项目,使用maven作为依赖项管理器/构建工具。我当前在将依赖项的依赖项解析到正确版本时遇到问题。 有问题的依赖项称为JasperReports-Functions-6.1.0.jar,它不是托管在maven repo中,而是以jar形式提供的。 如何强制jar依赖项使用子依赖项的某个版本?
问题:Maven在我的测试中找不到一些依赖项 在我的pom中是这样导入的。xml: 我已经试过了: mvn测试编译 使Intellij缓存无效 重启Intellij 清除. m2并重建项目
我们正在尝试使用java webstart开发一个打印应用程序。我们使用eclipse将jar创建为普通jar文件。我们的应用程序需要外部库来连接数据库、将数据转换为字节等。 我们以前可以通过将必要的JAR放入jre文件夹的/ext/目录来实现这一点。然而,这导致了与tomcat服务器的库冲突,所以我们希望避免这种方法。 我们还尝试将项目导出为可运行的jar,因为所需的库也已打包在jar中。但是当
我有一个多模块maven项目,包含三个模块、和 Core具有以下依赖项定义 我已经为所有三个模块添加了Java9定义,的如下所示: 但是,我不知道如何让的测试类能够在测试执行期间看到类。当尝试测试运行时,找不到类。 如果向的添加需要My.Project.TestUtils;的: 然后在编译时,我得到一个错误,即找不到模块(大概是因为它只是作为测试依赖项引入的)。 在Java9模块化的世界中,如何处