设备:Galaxy Tab S7
版本:Android 11
库:Spen_v5.0.0_full.aar
花费活动.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mBinding.apply {
lifecycleOwner = this@SpenActivity
spenSave.setOnClickListener(mSaveBtnClickListener)
}
try {
Spen().apply {
this.initialize(this@SpenActivity)
isSpenFeatureEnabled = this.isFeatureEnabled(Spen.DEVICE_PEN)
}
} catch (e: SsdkUnsupportedException) {
e.printStackTrace()
}
}
错误日志
enter code here
2021-05-20 16:41:02.975 15055-15055/? D/spe_log: 虚拟 SPen::RenderThreadGLImpl::~RenderThreadGLImpl()
2021-05-20 16:41:02.976 15055-17217/? D/spe_log: void SPen::EglContext::Destroy()
2021-05-20 16:41:02.976 15055-17217/? D/spe_log: void SPen::ShaderManagerImpl::CheckEmpty() 所有着色器已清理
2021-05-20 16:41:02.976 15055-15055/?D/spe_log: SPen::WorkerThreadImpl::~WorkerThreadImpl() [with TLocker = SPen::EmptyLocker] 清理
2021-05-20 16:41:02.976 15055-15055/? D/spe_log: void SPen::EglContext::Destroy()
2021-05-20 16:41:02.976 15055-15055/?D/SPen_Library: virtual void SPen::GLCanvasBase::ClearData() 已完成
2021-05-20 16:41:02.976 15055-15055/?D/spe_log: SPen::WorkerThreadImpl::WorkerThreadImpl() [with TLocker = SPen::EmptyLocker] 初始化
2021-05-20 16:41:02.976 15055-15055/? D/SPen_Library:GLCanvas 构造失败
2021-05-20 16:41:02.976 15055-15055/?D/JNI_Error:Error_GetError
2021-05-20 16:41:02.977 15055-15055/?D/AndroidRuntime: 关闭 VM
2021-05-20 16:41:02.977 15055-15055/? E/AndroidRuntime:致命异常:主
进程:com.srb.smart_sarangbang,PID:15055
java.lang.RuntimeException:无法启动活动 ComponentInfo{com.srb.smart_sarangbang/com.srb.smart_sarangbang.ui.SpenActivity}:java。 lang.RuntimeException:错误号为 0
在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3792)
在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3968)
在 android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
在 android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
在 android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95 )在
android.os.Looper.loop(Looper.java:246)
在 android.os.Handler.dispatchMessage(Handler.java:106)
在 android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
在 android .app.ActivityThread.main(ActivityThread.java:8512)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com .android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
原因:java.lang.RuntimeException:
com.samsung.android.sdk.pen.util.SpenError.ThrowUncheckedException(SpenError.java:122)
处 com.samsung.android.sdk.pen.engine.SpenGLInView处的错误编号为 0 .construct(SpenGLInView.java:441)
在 com.samsung.android.sdk.pen.engine.SpenGLInView.(SpenGLInView.java:418)
在 com.samsung.android.sdk.pen.engine.SpenSurfaceView.construct(SpenSurfaceView. java:363)
在 com.samsung.android.sdk.pen.engine.SpenSurfaceView.(SpenSurfaceView.java:274)
在 com.srb.smart_sarangbang.ui.SpenActivity.onCreate(SpenActivity.kt:80)
在 android.app。 Activity.performCreate(Activity.java:8198)
在 android.app.Activity.performCreate(Activity.java:8182)
在 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3765)
在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3968)
在 android.app。 servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app .ActivityThread$H.handleMessage(ActivityThread.java:2307)
在 android.os.Handler.dispatchMessage(Handler.java:106)
在 android.os.Looper.loop(Looper.java:246)
在 android.app.ActivityThread.main(ActivityThread.java:8512)
在 java.lang.reflect.Method.invoke(Native Method)
在 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
2021-05-20 16:41:03.045 15055-15055/? I/Process:发送信号。PID:15055 SIG:9
SpenGLInView.java
private void construct() {
Log.d("SpenGLInView", "construct() - nativeCanvas = " + this.nativeCanvas);
if (this.nativeCanvas == 0L) {
SpenError.ThrowUncheckedException(8, " : nativeCanvas must not be null");
} else if (this.mContext == null) {
SpenError.ThrowUncheckedException(8, " : context must not be null");
} else {
try {
PackageManager manager = this.mContext.getPackageManager();
this.mSdkResources = manager.getResourcesForApplication(Spen.getSpenPackageName());
} catch (NameNotFoundException var3) {
var3.printStackTrace();
}
this.mPenInfo = new SpenSettingPenInfo();
if (!Native_construct(this.nativeCanvas, this.mContext, this)) {
SpenError.ThrowUncheckedException(SpenError.getError());
}
this.mGestureDetector = new GestureDetector(this.mContext, new SpenGLInView.OnGestureListener());
this.mGestureDetector.setOnDoubleTapListener(new SpenGLInView.OnGestureDoubleTapListener());
DisplayMetrics mDisplayMetrics = this.mContext.getResources().getDisplayMetrics();
if (mDisplayMetrics != null) {
if (this.mDisplayInfo == null) {
this.mDisplayInfo = new SpenGLInView.DisplayInfo();
}
this.MIN_STROKE_LENGTH *= mDisplayMetrics.density;
this.mDisplayInfo.width = mDisplayMetrics.widthPixels;
this.mDisplayInfo.height = mDisplayMetrics.heightPixels;
this.mDisplayInfo.density = mDisplayMetrics.density;
Native_setDensity(this.nativeCanvas, mDisplayMetrics.density);
ArrayList<Object> objectList = new ArrayList();
objectList.add(this.mDisplayInfo);
Native_command(this.nativeCanvas, 10, objectList, 0);
this.mSmartScaleGestureDetector = new SpenSmartScaleGestureDetector(this.mContext, (float)mDisplayMetrics.densityDpi);
this.mSmartScaleGestureDetector.setListener(new SpenGLInView.OnSmartScaleGestureDetectorListener());
}
this.mScroll = new SpenScrollBar(this.mContext);
this.mHoverPointer = new SpenHoverPointerIconWrapper(this.mContext, this.mScroll);
this.mBlackPaint = new Paint();
this.mBlackPaint.setStyle(Style.FILL);
this.mBlackPaint.setColor(-15910321);
this.mPageDragHandler = new SpenGLPageDragHandler(new SpenGLInView.OnPageDragListener());
this.mPageDragHandler.setPaint(this.mBlackPaint);
this.mZoomPadLayer = new ArrayList();
this.mToolTip = new SpenToolTip(this.mContext);
this.mSelectObjectList = new ArrayList();
this.mNotePad = new SpenNotePad(this.mContext, true);
this.mNotePad.setActionListener(new SpenGLInView.OnNotePadActionListener());
this.mRemoverToastMessage = new Toast(this.mContext);
this.mSpenHapticSound = new SpenHapticSound(this.mContext);
this.mThisStrokeFrameListener = new SpenStrokeFrameListener() {
public void onCompleted(int frameType, SpenObjectContainer o) {
SpenGLInView.this.mStrokeFrame = null;
if (o.getExtraDataInt("STROKE_FRAME") == 1) {
SpenGLInView.this.mPageDoc.appendObject(o);
}
o.setVisibility(true);
o.setExtraDataInt("STROKE_FRAME", 2);
if (frameType == 0) {
o.getObject(0).setVisibility(true);
o.getObject(1).setVisibility(false);
SpenGLInView.this.mStrokeFrameType = frameType;
} else if (frameType == 1) {
o.getObject(1).setVisibility(true);
o.getObject(0).setVisibility(false);
SpenGLInView.this.mStrokeFrameType = frameType;
}
SpenGLInView.this.update();
if (SpenGLInView.this.mUpdateStrokeFrameListener != null) {
SpenGLInView.this.mUpdateStrokeFrameListener.onCompleted(frameType, o);
}
}
public void onCanceled(int state, SpenObjectContainer o) {
SpenGLInView.this.mStrokeFrame = null;
if ((state & 1) == 0 && o != null) {
o.setVisibility(true);
SpenGLInView.this.update();
}
if (SpenGLInView.this.mUpdateStrokeFrameListener != null) {
SpenGLInView.this.mUpdateStrokeFrameListener.onCanceled(state, o);
}
}
};
this.mTouchPath = new Path();
this.mTouchMeasure = new PathMeasure();
this.mImageAnimation = new SpenGLImageAnimation(new SpenGLInView.OnImageAnimationListener());
this.mSpenZoomAnimation = new SpenZoomAnimation(new SpenGLInView.OnZoomAnimationListener());
this.mMorphingAnimationHandler = new SpenMorphingAnimationHandler(this.mContext, new SpenGLInView.OnMorphingAnimation());
this.mOrientationListener = new OrientationEventListener(this.mContext) {
public void onOrientationChanged(int orientation) {
Log.d("TEST", "onOrientationChanged");
if (SpenGLInView.this.nativeCanvas != 0L) {
Display display = ((WindowManager)SpenGLInView.this.mContext.getSystemService("window")).getDefaultDisplay();
SpenGLInView.Native_setScreenOrientation(SpenGLInView.this.nativeCanvas, display.getRotation());
}
}
};
this.mOrientationListener.onOrientationChanged(0);
this.mAutoRecognizerListenr = new Listener() {
public void onStartAnimation() {
SpenGLInView.this.update();
SpenGLInView.this.startTemporaryStroke();
SpenGLInView.this.mIsMorphing = true;
}
public void onUpdate(ArrayList<SpenObjectBase> recognizedObject) {
SpenGLInView.this.drawTemporaryObject(recognizedObject, new ArrayList(), 255);
}
public void onFinish() {
SpenGLInView.this.update();
SpenGLInView.this.stopTemporaryStroke();
SpenGLInView.this.cancelStroke();
SpenGLInView.this.mIsMorphing = false;
}
public boolean onRecognized(int count) {
if (SpenGLInView.this.mAutoReconitionListener != null) {
SpenGLInView.this.mAutoReconitionListener.onRecognized(count);
return false;
} else {
return true;
}
}
};
}
}
描述
它在Android 10上正常工作,但在Android 11上出现错误。我正在寻求帮助,因为我找不到原因。