- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
每次调用 scanner.process(image) 都会导致调用 onFailure,并出现以下错误:
Error:com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
关于任务失败的原因的任何进一步细节或想法?用条形码出示它似乎也不会改变这种行为。
此错误在使用 Pixel 3a 时显示,但在 Nexus 5 上完全崩溃并出现 SIGENV 错误。在阅读 overview 时,我一直在从 fragment 构建我的代码
package jp.oist.cameraxapp;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.camera.core.Camera;
import androidx.camera.core.CameraSelector;
import androidx.camera.core.ImageAnalysis;
import androidx.camera.core.ImageCapture;
import androidx.camera.core.ImageProxy;
import androidx.camera.core.Preview;
import androidx.camera.lifecycle.ProcessCameraProvider;
import androidx.camera.view.PreviewView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.media.Image;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.mlkit.vision.barcode.Barcode;
import com.google.mlkit.vision.barcode.BarcodeScanner;
import com.google.mlkit.vision.barcode.BarcodeScannerOptions;
import com.google.mlkit.vision.barcode.BarcodeScanning;
import com.google.mlkit.vision.common.InputImage;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MainActivity extends AppCompatActivity {
private static final int PERMISSION_REQUESTS = 1;
private ListenableFuture<ProcessCameraProvider> cameraProviderFuture;
private ExecutorService executor;
private static String TAG = "abcvlibCameraX";
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!allPermissionsGranted()) {
getRuntimePermissions();
}
setContentView(R.layout.activity_main);
executor = Executors.newSingleThreadExecutor();
PreviewView previewView = findViewById(R.id.previewView);
cameraProviderFuture = ProcessCameraProvider.getInstance(this);
cameraProviderFuture.addListener(() -> {
try {
// Camera provider is now guaranteed to be available
ProcessCameraProvider cameraProvider = cameraProviderFuture.get();
// Set up the view finder use case to display camera preview
Preview preview = new Preview.Builder().build();
// Choose the camera by requiring a lens facing
CameraSelector cameraSelector = new CameraSelector.Builder()
.requireLensFacing(CameraSelector.LENS_FACING_FRONT)
.build();
// Connect the preview use case to the previewView
preview.setSurfaceProvider(
previewView.createSurfaceProvider());
// Set up the capture use case to allow users to take photos
ImageCapture imageCapture = new ImageCapture.Builder()
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.build();
ImageAnalysis imageAnalysis =
new ImageAnalysis.Builder()
.build();
imageAnalysis.setAnalyzer(ContextCompat.getMainExecutor(this), new ImageAnalysis.Analyzer() {
private BarcodeScanner scanner = buildBarCodeScanner();
@Override
public void analyze(ImageProxy imageProxy) {
@SuppressLint("UnsafeExperimentalUsageError") Image mediaImage = imageProxy.getImage();
if (mediaImage != null) {
InputImage image =
InputImage.fromMediaImage(mediaImage, imageProxy.getImageInfo().getRotationDegrees());
// Pass image to an ML Kit Vision API
Task<List<Barcode>> result = scanner.process(image);
result.addOnSuccessListener(new OnSuccessListener<List<Barcode>>() {
@Override
public void onSuccess(List<Barcode> barcodes) {
// Task completed successfully
Log.i("CameraXApp3", "scanner task successful");
processBarCodes(barcodes);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Task failed with an exception
Log.i("CameraXApp3", "scanner task failed. Error:" + e);
}
});
mediaImage.close();
imageProxy.close();
}
}
private BarcodeScanner buildBarCodeScanner() {
BarcodeScannerOptions options =
new BarcodeScannerOptions.Builder()
.setBarcodeFormats(
Barcode.FORMAT_QR_CODE)
.build();
return BarcodeScanning.getClient(options);
}
//
private void processBarCodes(List<Barcode> barcodes) {
for (Barcode barcode : barcodes) {
String rawValue = barcode.getRawValue();
int valueType = barcode.getValueType();
// See API reference for complete list of supported types
if (valueType == Barcode.TYPE_TEXT) {
toast(MainActivity.this, "Received Message:" + rawValue);
}
}
}
public void toast(final Context context, final String text) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> Toast.makeText(context, text, Toast.LENGTH_LONG).show());
}
});
// Attach use cases to the camera with the same lifecycle owner
Camera camera = cameraProvider.bindToLifecycle(
((LifecycleOwner) this),
cameraSelector,
preview,
imageCapture,
imageAnalysis);
} catch (InterruptedException | ExecutionException e) {
// Currently no exceptions thrown. cameraProviderFuture.get() should
// not block since the listener is being called, so no need to
// handle InterruptedException.
}
}, ContextCompat.getMainExecutor(this));
}
private void getRuntimePermissions() {
List<String> allNeededPermissions = new ArrayList<>();
for (String permission : getRequiredPermissions()) {
if (!isPermissionGranted(this, permission)) {
allNeededPermissions.add(permission);
}
}
if (!allNeededPermissions.isEmpty()) {
ActivityCompat.requestPermissions(
this, allNeededPermissions.toArray(new String[0]), PERMISSION_REQUESTS);
}
}
private static boolean isPermissionGranted(Context context, String permission) {
if (ContextCompat.checkSelfPermission(context, permission)
== PackageManager.PERMISSION_GRANTED) {
Log.i(TAG, "Permission granted: " + permission);
return true;
}
Log.i(TAG, "Permission NOT granted: " + permission);
return false;
}
private boolean allPermissionsGranted() {
for (String permission : getRequiredPermissions()) {
if (!isPermissionGranted(this, permission)) {
return false;
}
}
return true;
}
private String[] getRequiredPermissions() {
try {
PackageInfo info =
this.getPackageManager()
.getPackageInfo(this.getPackageName(), PackageManager.GET_PERMISSIONS);
String[] ps = info.requestedPermissions;
if (ps != null && ps.length > 0) {
return ps;
} else {
return new String[0];
}
} catch (Exception e) {
return new String[0];
}
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "jp.oist.cameraxapp"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.camera:camera-camera2:1.0.0-beta07'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// CameraX core library using the camera2 implementation
def camerax_version = "1.0.0-beta07"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-view:1.0.0-alpha14"
implementation 'com.google.mlkit:barcode-scanning:16.0.2'
}
2020-08-04 12:51:05.192 17716-17716/? I/oist.cameraxap: Late-enabling -Xcheck:jni
2020-08-04 12:51:05.224 17716-17716/? E/oist.cameraxap: Unknown bits set in runtime_flags: 0x8000
2020-08-04 12:51:05.596 17716-17716/jp.oist.cameraxapp I/abcvlibCameraX: Permission granted: android.permission.CAMERA
2020-08-04 12:51:05.647 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2020-08-04 12:51:05.648 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2020-08-04 12:51:05.699 17716-17751/jp.oist.cameraxapp I/CameraManagerGlobal: Connecting to camera service
2020-08-04 12:51:05.714 17716-17751/jp.oist.cameraxapp D/CameraRepository: Added camera: 0
2020-08-04 12:51:05.729 17716-17751/jp.oist.cameraxapp I/Camera2CameraInfo: Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_FULL
2020-08-04 12:51:05.732 17716-17751/jp.oist.cameraxapp D/CameraRepository: Added camera: 1
2020-08-04 12:51:05.734 17716-17752/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [] for camera: 0
2020-08-04 12:51:05.735 17716-17751/jp.oist.cameraxapp I/Camera2CameraInfo: Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_FULL
2020-08-04 12:51:05.737 17716-17752/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [] for camera: 1
2020-08-04 12:51:05.749 17716-17747/jp.oist.cameraxapp I/AdrenoGLES: QUALCOMM build : ba734b1, I0a3e8c4129
Build Date : 11/11/19
OpenGL ES Shader Compiler Version: EV031.27.05.02
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.7.8.9.C1.08.00.00.516.287
Remote Branch : NONE
Reconstruct Branch : NOTHING
2020-08-04 12:51:05.749 17716-17747/jp.oist.cameraxapp I/AdrenoGLES: Build Config : S P 8.0.11 AArch64
2020-08-04 12:51:05.752 17716-17747/jp.oist.cameraxapp I/AdrenoGLES: PFP: 0x016ee183, ME: 0x00000000
2020-08-04 12:51:05.765 17716-17747/jp.oist.cameraxapp W/Gralloc3: mapper 3.x is not supported
2020-08-04 12:51:05.844 17716-17755/jp.oist.cameraxapp I/DynamiteModule: Considering local module com.google.mlkit.dynamite.barcode:10000 and remote module com.google.mlkit.dynamite.barcode:0
2020-08-04 12:51:05.844 17716-17755/jp.oist.cameraxapp I/DynamiteModule: Selected local version of com.google.mlkit.dynamite.barcode
2020-08-04 12:51:05.851 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
2020-08-04 12:51:05.853 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-08-04 12:51:05.853 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-08-04 12:51:05.853 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-08-04 12:51:05.854 17716-17755/jp.oist.cameraxapp I/tflite: Initialized TensorFlow Lite runtime.
2020-08-04 12:51:05.855 17716-17755/jp.oist.cameraxapp I/native: barcode_detector_client.cc:238 Not using NNAPI
2020-08-04 12:51:05.857 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, linking, allowed)
2020-08-04 12:51:05.857 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-08-04 12:51:05.857 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api, linking, allowed)
2020-08-04 12:51:05.857 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->arrayIndexScale(Ljava/lang/Class;)I (greylist, linking, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->peekLong(JZ)J (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->pokeLong(JJZ)V (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->pokeInt(JIZ)V (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->peekInt(JZ)I (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->pokeByteArray(J[BII)V (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->peekByteArray(J[BII)V (greylist, reflection, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2020-08-04 12:51:05.859 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden field Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
2020-08-04 12:51:05.860 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
2020-08-04 12:51:05.870 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-08-04 12:51:05.870 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-08-04 12:51:05.870 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-08-04 12:51:05.947 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [] for camera: 1
2020-08-04 12:51:05.951 17716-17752/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [] for camera: 1
2020-08-04 12:51:05.955 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [] for camera: 1
2020-08-04 12:51:05.955 17716-17751/jp.oist.cameraxapp I/chatty: uid=10124(jp.oist.cameraxapp) CameraX-core_ca identical 1 line
2020-08-04 12:51:05.955 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [] for camera: 1
2020-08-04 12:51:05.956 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-7f499a18-73ff-41cb-9217-2d0fe0b6345c255079241, androidx.camera.core.ImageAnalysis-22cf2c3d-6cbe-447a-9fa4-192f608ff6d5223414639, androidx.camera.core.ImageCapture-041129af-ca2e-48a7-85f5-0fa752f78a4172369230] for camera: 1
2020-08-04 12:51:05.957 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: Active and attached use case: [androidx.camera.core.Preview-7f499a18-73ff-41cb-9217-2d0fe0b6345c255079241, androidx.camera.core.ImageAnalysis-22cf2c3d-6cbe-447a-9fa4-192f608ff6d5223414639, androidx.camera.core.ImageCapture-041129af-ca2e-48a7-85f5-0fa752f78a4172369230] for camera: 1
2020-08-04 12:51:05.959 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-7f499a18-73ff-41cb-9217-2d0fe0b6345c255079241, androidx.camera.core.ImageAnalysis-22cf2c3d-6cbe-447a-9fa4-192f608ff6d5223414639, androidx.camera.core.ImageCapture-041129af-ca2e-48a7-85f5-0fa752f78a4172369230] for camera: 1
2020-08-04 12:51:05.964 17716-17716/jp.oist.cameraxapp D/PreviewView: Surface requested by Preview.
2020-08-04 12:51:05.977 17716-17751/jp.oist.cameraxapp D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-7f499a18-73ff-41cb-9217-2d0fe0b6345c255079241, androidx.camera.core.ImageAnalysis-22cf2c3d-6cbe-447a-9fa4-192f608ff6d5223414639, androidx.camera.core.ImageCapture-041129af-ca2e-48a7-85f5-0fa752f78a4172369230] for camera: 1
2020-08-04 12:51:05.992 17716-17716/jp.oist.cameraxapp D/SurfaceViewImpl: Surface created.
2020-08-04 12:51:05.992 17716-17716/jp.oist.cameraxapp D/SurfaceViewImpl: Surface changed. Size: 1600x1200
2020-08-04 12:51:05.994 17716-17716/jp.oist.cameraxapp D/SurfaceViewImpl: Surface set on Preview.
2020-08-04 12:51:05.997 17716-17752/jp.oist.cameraxapp D/CaptureSession: Opening capture session.
2020-08-04 12:51:06.149 17716-17752/jp.oist.cameraxapp D/CaptureSession: Attempting to send capture request onConfigured
2020-08-04 12:51:06.149 17716-17752/jp.oist.cameraxapp D/CaptureSession: Issuing request for session.
2020-08-04 12:51:06.153 17716-17752/jp.oist.cameraxapp D/CaptureSession: CameraCaptureSession.onConfigured() mState=OPENED
2020-08-04 12:51:06.154 17716-17752/jp.oist.cameraxapp D/CaptureSession: CameraCaptureSession.onReady() OPENED
2020-08-04 12:51:06.154 17716-17739/jp.oist.cameraxapp W/Gralloc3: allocator 3.x is not supported
2020-08-04 12:51:06.320 17716-17752/jp.oist.cameraxapp D/StreamStateObserver: Update Preview stream state to STREAMING
2020-08-04 12:51:06.359 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-08-04 12:51:06.359 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-08-04 12:51:06.359 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-08-04 12:51:06.363 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
2020-08-04 12:51:06.365 17716-17716/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
2020-08-04 12:51:06.369 17716-17716/jp.oist.cameraxapp I/CameraXApp3: scanner task failed. Error:com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
2020-08-04 12:51:06.373 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-08-04 12:51:06.373 17716-17716/jp.oist.cameraxapp I/CameraXApp3: scanner task failed. Error:com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
2020-08-04 12:51:06.376 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-08-04 12:51:06.376 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-08-04 12:51:06.377 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-08-04 12:51:06.378 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-08-04 12:51:06.378 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-08-04 12:51:06.379 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
2020-08-04 12:51:06.379 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-08-04 12:51:06.379 17716-17754/jp.oist.cameraxapp W/oist.cameraxap: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-08-04 12:51:06.406 17716-17716/jp.oist.cameraxapp I/CameraXApp3: scanner task failed. Error:com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
2020-08-04 12:51:07.309 17716-17716/jp.oist.cameraxapp I/chatty: uid=10124(jp.oist.cameraxapp) identical 27 lines
最佳答案
无意中通过阅读this找到了错误原因.将 OnCompleteListener 添加到结果任务并将 imageProxy.close() 放入其中,解决了这个问题。即:
Task<List<Barcode>> result = scanner.process(image);
result.addOnSuccessListener(new OnSuccessListener<List<Barcode>>() {
@Override
public void onSuccess(List<Barcode> barcodes) {
// Task completed successfully
Log.i("CameraXApp3", "scanner task successful");
processBarCodes(barcodes);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Task failed with an exception
Log.i("CameraXApp3", "scanner task failed. Error:" + e);
}
});
mediaImage.close();
imageProxy.close();
Task<List<Barcode>> result = scanner.process(image);
result.addOnSuccessListener(new OnSuccessListener<List<Barcode>>() {
@Override
public void onSuccess(List<Barcode> barcodes) {
// Task completed successfully
Log.i("CameraXApp3", "scanner task successful");
processBarCodes(barcodes);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// Task failed with an exception
Log.i("CameraXApp3", "scanner task failed. Error:" + e);
}
}).addOnCompleteListener(new OnCompleteListener<List<Barcode>>() {
@Override
public void onComplete(@NonNull Task<List<Barcode>> task) {
mediaImage.close();
imageProxy.close();
}
});
将等待标记为答案,以防@Hoi 想要获得他应得的积分。 :)
关于java - MLKit BarCode Sanner Implementation 在执行 ML Kit 任务时导致内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63240081/
SQLite、Content provider 和 Shared Preference 之间的所有已知区别。 但我想知道什么时候需要根据情况使用 SQLite 或 Content Provider 或
警告:我正在使用一个我无法完全控制的后端,所以我正在努力解决 Backbone 中的一些注意事项,这些注意事项可能在其他地方更好地解决......不幸的是,我别无选择,只能在这里处理它们! 所以,我的
我一整天都在挣扎。我的预输入搜索表达式与远程 json 数据完美配合。但是当我尝试使用相同的 json 数据作为预取数据时,建议为空。点击第一个标志后,我收到预定义消息“无法找到任何内容...”,结果
我正在制作一个模拟 NHL 选秀彩票的程序,其中屏幕右侧应该有一个 JTextField,并且在左侧绘制弹跳的选秀球。我创建了一个名为 Ball 的类,它实现了 Runnable,并在我的主 Draf
这个问题已经有答案了: How can I calculate a time span in Java and format the output? (18 个回答) 已关闭 9 年前。 这是我的代码
我有一个 ASP.NET Web API 应用程序在我的本地 IIS 实例上运行。 Web 应用程序配置有 CORS。我调用的 Web API 方法类似于: [POST("/API/{foo}/{ba
我将用户输入的时间和日期作为: DatePicker dp = (DatePicker) findViewById(R.id.datePicker); TimePicker tp = (TimePic
放宽“邻居”的标准是否足够,或者是否有其他标准行动可以采取? 最佳答案 如果所有相邻解决方案都是 Tabu,则听起来您的 Tabu 列表的大小太长或您的释放策略太严格。一个好的 Tabu 列表长度是
我正在阅读来自 cppreference 的代码示例: #include #include #include #include template void print_queue(T& q)
我快疯了,我试图理解工具提示的行为,但没有成功。 1. 第一个问题是当我尝试通过插件(按钮 1)在点击事件中使用它时 -> 如果您转到 Fiddle,您会在“内容”内看到该函数' 每次点击都会调用该属
我在功能组件中有以下代码: const [ folder, setFolder ] = useState([]); const folderData = useContext(FolderContex
我在使用预签名网址和 AFNetworking 3.0 从 S3 获取图像时遇到问题。我可以使用 NSMutableURLRequest 和 NSURLSession 获取图像,但是当我使用 AFHT
我正在使用 Oracle ojdbc 12 和 Java 8 处理 Oracle UCP 管理器的问题。当 UCP 池启动失败时,我希望关闭它创建的连接。 当池初始化期间遇到 ORA-02391:超过
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 9 年前。 Improve
引用这个plunker: https://plnkr.co/edit/GWsbdDWVvBYNMqyxzlLY?p=preview 我在 styles.css 文件和 src/app.ts 文件中指定
为什么我的条形这么细?我尝试将宽度设置为 1,它们变得非常厚。我不知道还能尝试什么。默认厚度为 0.8,这是应该的样子吗? import matplotlib.pyplot as plt import
当我编写时,查询按预期执行: SELECT id, day2.count - day1.count AS diff FROM day1 NATURAL JOIN day2; 但我真正想要的是右连接。当
我有以下时间数据: 0 08/01/16 13:07:46,335437 1 18/02/16 08:40:40,565575 2 14/01/16 22:2
一些背景知识 -我的 NodeJS 服务器在端口 3001 上运行,我的 React 应用程序在端口 3000 上运行。我在 React 应用程序 package.json 中设置了一个代理来代理对端
我面临着一个愚蠢的问题。我试图在我的 Angular 应用程序中延迟加载我的图像,我已经尝试过这个2: 但是他们都设置了 src attr 而不是 data-src,我在这里遗漏了什么吗?保留 d
我是一名优秀的程序员,十分优秀!