私はScanLibraryをhereから使用しています。私はこれをうまく実装しており、Xiomiを除くすべてのデバイスで正常に動作しています。なぜ私はXiomiに取り組んでいないのだろうか。私はマシュマロ、ロリポップ、その他のAPIでこれをテストしましたが、他のすべてのデバイスで正常に動作しています。Xiomiだけに問題があります。私はまた、彼らのgithubページでこれを報告しようとしたが、私の最後の希望はstackoverflowなので、返信を得た。私がXiomiで働いていない理由を理解することはできません。Android ScanlibraryがXiomiでクラッシュする
私はXiomiデバイス上で、次の例外を取得しています:
ScanActivity.java
package com.scanlibrary;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.FragmentTransaction;
import android.content.ComponentCallbacks2;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
/**
* Created by jhansi on 28/03/15.
*/
public class ScanActivity extends Activity implements IScanner, ComponentCallbacks2 {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.scan_layout);
init();
}
private void init() {
PickImageFragment fragment = new PickImageFragment();
Bundle bundle = new Bundle();
bundle.putInt(ScanConstants.OPEN_INTENT_PREFERENCE, getPreferenceContent());
fragment.setArguments(bundle);
android.app.FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.content, fragment);
fragmentTransaction.commit();
}
protected int getPreferenceContent() {
return getIntent().getIntExtra(ScanConstants.OPEN_INTENT_PREFERENCE, 0);
}
@Override
public void onBitmapSelect(Uri uri) {
ScanFragment fragment = new ScanFragment();
Bundle bundle = new Bundle();
bundle.putParcelable(ScanConstants.SELECTED_BITMAP, uri);
fragment.setArguments(bundle);
android.app.FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.content, fragment);
fragmentTransaction.addToBackStack(ScanFragment.class.toString());
fragmentTransaction.commit();
}
@Override
public void onScanFinish(Uri uri) {
ResultFragment fragment = new ResultFragment();
Bundle bundle = new Bundle();
bundle.putParcelable(ScanConstants.SCANNED_RESULT, uri);
fragment.setArguments(bundle);
android.app.FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.content, fragment);
fragmentTransaction.addToBackStack(ResultFragment.class.toString());
fragmentTransaction.commit();
}
@Override
public void onTrimMemory(int level) {
switch (level) {
case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
/*
Release any UI objects that currently hold memory.
The user interface has moved to the background.
*/
break;
case ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE:
case ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW:
case ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL:
/*
Release any memory that your app doesn't need to run.
The device is running low on memory while the app is running.
The event raised indicates the severity of the memory-related event.
If the event is TRIM_MEMORY_RUNNING_CRITICAL, then the system will
begin killing background processes.
*/
break;
case ComponentCallbacks2.TRIM_MEMORY_BACKGROUND:
case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
/*
Release as much memory as the process can.
The app is on the LRU list and the system is running low on memory.
The event raised indicates where the app sits within the LRU list.
If the event is TRIM_MEMORY_COMPLETE, the process will be one of
the first to be terminated.
*/
new AlertDialog.Builder(this)
.setTitle(R.string.low_memory)
.setMessage(R.string.low_memory_message)
.create()
.show();
break;
default:
/*
Release any non-critical data structures.
The app received an unrecognized memory level value
from the system. Treat this as a generic low-memory message.
*/
break;
}
}
public native Bitmap getScannedBitmap(Bitmap bitmap, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
public native Bitmap getGrayBitmap(Bitmap bitmap);
public native Bitmap getMagicColorBitmap(Bitmap bitmap);
public native Bitmap getBWBitmap(Bitmap bitmap);
public native float[] getPoints(Bitmap bitmap);
//========== GETTING ERROR OVER HERE ================//
static {
System.loadLibrary("opencv_java3"); //========== HERE IS THE ERROR ================//
System.loadLibrary("Scanner");
}
}
かどうかを確認してください:私はエラーが出てい
05-18 15:33:33.504 21553-21553/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.vikast.includelibrariesdemo, PID: 21553
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.vikast.includelibrariesdemo-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.vikast.includelibrariesdemo-2/lib/arm64, /data/app/com.example.vikast.includelibrariesdemo-2/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libopencv_java3.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.scanlibrary.ScanActivity.<clinit>(ScanActivity.java:125)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2324)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
ライブラリのクラスを私のアプリがMiデバイスでクラッシュするような問題があります。前もって感謝します..!!
どのXiaomiデバイスを使用していますか? –
MI redmi 3SプライムとMI 4i – UltimateDevil
の両方を使用しています。どちらのデバイスも64ビットCPUアーキテクチャです。 –