在尝试使用OpenGL绘制图像时,测试机用的是华为P30 运行报错.
报错代码:
GLES20.glCreateProgram();
错误信息:
2020-08-25 09:31:18.409 6138-6138/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-08-25 09:31:18.409 6138-6138/? A/DEBUG: Build fingerprint: 'HUAWEI/ELE-AL00/HWELE:10/HUAWEIELE-AL00/10.1.0.162C00:user/release-keys'
2020-08-25 09:31:18.409 6138-6138/? A/DEBUG: Revision: '0'
2020-08-25 09:31:18.409 6138-6138/? A/DEBUG: ABI: 'arm64'
2020-08-25 09:31:18.413 6138-6138/? A/DEBUG: SYSVMTYPE: Maple
APPVMTYPE: Art
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: Timestamp: 2020-08-25 09:31:18+0800
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: pid: 6078, tid: 6132, name: GLThread 6390 >>> com.layren.heartflower <<<
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: uid: 10275
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: Cause: null pointer dereference
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x0 0000007167e11740 x1 00000071013a3cc4 x2 0000000000000000 x3 000000717660ec00
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x4 00000071013a4650 x5 000000717d4690ad x6 3f00000000000000 x7 0000000000000000
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x8 8f4a811ee6efac75 x9 8f4a811ee6efac75 x10 0000000000430000 x11 000000717eb45448
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x12 000000717eb4549c x13 000000717eb454f0 x14 000000717eb45550 x15 0000000000000000
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x16 0000000000000000 x17 0000007201093270 x18 00000071002ce000 x19 000000717660ec00
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x20 00000071ff8a3d98 x21 000000717660ec00 x22 00000071013a3f00 x23 000000717d4690ad
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x24 0000000000000000 x25 00000071013a5020 x26 000000717660ecb0 x27 0000000000000000
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: x28 0000000000000000 x29 00000071013a3d80
2020-08-25 09:31:18.414 6138-6138/? A/DEBUG: sp 00000071013a3cb0 lr 00000000726098c4 pc 0000000000000000
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: backtrace:
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #00 pc 0000000000000000 <unknown>
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #01 pc 00000000002d68c0 /system/framework/arm64/boot-framework.oat (art_jni_trampoline+144) (BuildId: 6f38e90c1f84e093b10f23cb45c9e9857f154d25)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #02 pc 00000000001435b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #03 pc 00000000001521c4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+284) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #04 pc 00000000002ee360 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #05 pc 00000000002e9630 /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+912) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #06 pc 00000000005b95ec /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+368) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #07 pc 000000000013d994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #08 pc 0000000000014668 [anon:dalvik-classes2.dex extracted in memory from /data/app/com.layren.heartflower-kdi-hhisTnccwpmWdXWntg==/base.apk!classes2.dex] (com.layren.heartflower.opengl.Triangle.<init>+120)
2020-08-25 09:31:18.593 6138-6138/? A/DEBUG: #09 pc 00000000005b90e0 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+1168) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #10 pc 000000000013d914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #11 pc 00000000000143d0 [anon:dalvik-classes2.dex extracted in memory from /data/app/com.layren.heartflower-kdi-hhisTnccwpmWdXWntg==/base.apk!classes2.dex] (com.layren.heartflower.opengl.OpenGLActivity$1.onSurfaceCreated+20)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #12 pc 00000000005b8544 /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1752) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #13 pc 000000000013da14 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_interface+20) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #14 pc 00000000002fb712 /system/framework/framework.jar (android.opengl.GLSurfaceView$GLThread.guardedRun+890)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #15 pc 00000000005b90e0 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+1168) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #16 pc 000000000013d914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #17 pc 00000000002fbdd0 /system/framework/framework.jar (android.opengl.GLSurfaceView$GLThread.run+48)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #18 pc 00000000002bef9c /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.8556287075661799849+240) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #19 pc 00000000005a7758 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #20 pc 000000000014c468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #21 pc 0000000000143334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #22 pc 00000000001521a4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+252) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #23 pc 00000000004c84d8 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #24 pc 00000000004c956c /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #25 pc 000000000050953c /apex/com.android.runtime/lib64/libart.so (art::Thread::CreateCallback(void*)+1176) (BuildId: 8fd6eb29d525cc73cb2b34726c89ab35)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #26 pc 00000000000ce1b0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: 212095a5bb472f1fd33898cf4066bc50)
2020-08-25 09:31:18.594 6138-6138/? A/DEBUG: #27 pc 0000000000070ba8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 212095a5bb472f1fd33898cf4066bc50)
此代码用另一部手机(vivo x9 plus) 是正常的..
不知道是哪些地方需要额外配置或修改...