gpt4 book ai didi

java - Android InflateException - 膨胀类 com.google.vr.sdk.base.GvrView 时出错

转载 作者:行者123 更新时间:2023-12-01 09:32:45 27 4
gpt4 key购买 nike

我试图在一个新项目中加入 Google Cardboard SDK 的“audio”、“base”和“common”模块并在 x86_64 模拟器上运行,但我不断收到以下错误:

09-01 14:38:36.378 8768-8768/com.verbraeken.joost.roarenginedemo W/System: ClassLoader referenced unknown path: /data/app/com.verbraeken.joost.roarenginedemo-2/lib/x86_64
09-01 14:38:36.514 8768-8768/com.verbraeken.joost.roarenginedemo W/System: ClassLoader referenced unknown path: /data/app/com.verbraeken.joost.roarenginedemo-2/lib/x86_64
09-01 14:38:36.714 8768-8768/com.verbraeken.joost.roarenginedemo D/ConfigUtils: Parameters file not found for reading: java.io.FileNotFoundException: /storage/emulated/0/Cardboard/current_device_params: open failed: ENOENT (No such file or directory)
09-01 14:38:36.714 8768-8768/com.verbraeken.joost.roarenginedemo D/CardboardViewNativeImpl: NativeProxy not found
09-01 14:38:36.714 8768-8768/com.verbraeken.joost.roarenginedemo D/CardboardViewNativeImpl: Loading native library gvrbase
09-01 14:38:36.718 8768-8768/com.verbraeken.joost.roarenginedemo D/AndroidRuntime: Shutting down VM
09-01 14:38:36.719 8768-8768/com.verbraeken.joost.roarenginedemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.verbraeken.joost.roarenginedemo, PID: 8768
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.verbraeken.joost.roarenginedemo/com.verbraeken.joost.roarenginedemo.MainActivity}: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class com.google.vr.sdk.base.GvrView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class com.google.vr.sdk.base.GvrView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
at android.app.Activity.setContentView(Activity.java:2166)
at com.verbraeken.joost.roarenginedemo.MainActivity.onCreate(MainActivity.java:29)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.google.vr.sdk.base.GvrView
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
at android.app.Activity.setContentView(Activity.java:2166) 
at com.verbraeken.joost.roarenginedemo.MainActivity.onCreate(MainActivity.java:29) 
at android.app.Activity.performCreate(Activity.java:6237) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
at android.app.Activity.setContentView(Activity.java:2166) 
at com.verbraeken.joost.roarenginedemo.MainActivity.onCreate(MainActivity.java:29) 
at android.app.Activity.performCreate(Activity.java:6237) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Caused by: java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-logansquare-1.3.6_716acd6a9767b2e8e1dfddc8c163119e550e393e-classes.dex", dex file "/data/data/com.verbraeken.joost.roarenginedemo/files/instant-run/dex/slice-jackson-core-2.5.1_d4f9878edbf4e7675b2818a3e9e4f0b8
09-01 14:38:46.911 8768-8768/com.verbraeken.joost.roarenginedemo I/Process: Sending signal. PID: 8768 SIG: 9

关于同一问题的其他一些帖子表示可以通过在 build.gradle 和 proguard 文件中放入一些代码来解决该问题。对于 build.gradle :

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ndk {
abiFilters "armeabi-v7a", "armeabi", "x86", "x86_64"
}
}
debug {
ndk {
abiFilters "armeabi-v7a", "armeabi", "x86", "x86_64"
}
}
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk false
}
}

对于混淆器文件:

-keep class com.google.vr.**
-keepclassmembers class com.google.vr.** { *; }
-keep class com.google.vr.**$*
-keepclassmembers class com.google.vr.**$* { *; }
-keep class com.google.geo.render.**
-keepclassmembers class com.google.geo.render.** { *; }
-keep class com.google.vrtoolkit.cardboard.** { *; }

但是,它不起作用,并且我不断收到错误消息。有人知道如何修复它吗?

附注抱歉我的英语不好,我的母语不是英语

最佳答案

我遇到了同样的问题,然后我检查了 Google VR SDK 中的示例应用程序,我复制了相同的 gradle.build 文件,它对我有用。请尝试这个可能会有所帮助..

更改build.gradle文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled true
proguardFiles.add(file('../../proguard-gvr.txt'))
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile project(':audio')
compile project(':base')
compile project(':common')
compile project(':commonwidget')
compile project(':controller')
compile project(':panowidget')
compile project(':videowidget')

compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
}

关于java - Android InflateException - 膨胀类 com.google.vr.sdk.base.GvrView 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39272116/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com