ViroCore: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/vr/ndk/base/GvrLayout;
ViroCore: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/vr/ndk/base/GvrLayout;
我已经下载了最新版本的 ViroCore 库 (virocore-release-v_1_7_2.aar),然后我将下面的依赖项添加到我的 build.gradle 文件
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:25.0.0'
implementation 'com.google.android.exoplayer:exoplayer:r2.2.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation (name:'virocore-release-v_1_7_2', ext: 'aar')
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
implementation 'com.amazonaws:aws-android-sdk-core:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-ddb:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'}
然后写到我下面的ViroActivity代码:
private ViroView createGVRView() {
return new ViroViewGVR(this, new ViroViewGVR.StartupListener() {
@Override
public void onSuccess() {
onRendererStart();
}
@Override
public void onFailure(ViroViewGVR.StartupError error, String errorMessage) {
onRendererFailed(error.toString(), errorMessage);
}
}, new Runnable() {
@Override
public void run() {
}
});
}
但是当 运行 应用程序时,我总是看到下一个异常:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.virosample.gvr.ovr, PID: 17304
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/vr/ndk/base/GvrLayout;
at com.viro.core.ViroViewGVR.init(ViroViewGVR.java:287)
at com.viro.core.ViroViewGVR.<init>(ViroViewGVR.java:211)
at com.example.panorama.ui.view.ViroActivityVR.createGVRView(ViroActivityVR.java:104)
at com.example.panorama.ui.view.ViroActivityVR.onCreate(ViroActivityVR.java:90)
...
有人知道如何解决这个异常吗?
我解决了这个问题。我只添加了 viro 库到我的依赖项中,但我必须另外添加 sdk-common.aar 和 core.aar,您可以在官方 virocore 站点下载它们。
我已经下载了最新版本的 ViroCore 库 (virocore-release-v_1_7_2.aar),然后我将下面的依赖项添加到我的 build.gradle 文件
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:25.0.0'
implementation 'com.google.android.exoplayer:exoplayer:r2.2.0'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation (name:'virocore-release-v_1_7_2', ext: 'aar')
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
implementation 'com.amazonaws:aws-android-sdk-core:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-ddb:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-cognito:2.2.+'
implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'}
然后写到我下面的ViroActivity代码:
private ViroView createGVRView() {
return new ViroViewGVR(this, new ViroViewGVR.StartupListener() {
@Override
public void onSuccess() {
onRendererStart();
}
@Override
public void onFailure(ViroViewGVR.StartupError error, String errorMessage) {
onRendererFailed(error.toString(), errorMessage);
}
}, new Runnable() {
@Override
public void run() {
}
});
}
但是当 运行 应用程序时,我总是看到下一个异常:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.virosample.gvr.ovr, PID: 17304
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/vr/ndk/base/GvrLayout;
at com.viro.core.ViroViewGVR.init(ViroViewGVR.java:287)
at com.viro.core.ViroViewGVR.<init>(ViroViewGVR.java:211)
at com.example.panorama.ui.view.ViroActivityVR.createGVRView(ViroActivityVR.java:104)
at com.example.panorama.ui.view.ViroActivityVR.onCreate(ViroActivityVR.java:90)
...
有人知道如何解决这个异常吗?
我解决了这个问题。我只添加了 viro 库到我的依赖项中,但我必须另外添加 sdk-common.aar 和 core.aar,您可以在官方 virocore 站点下载它们。