我构建textFairy
运行正常但是当从库中选择图像时出错:
在build.gradle
我已设置jniLibs.srcDir 'src/main/libs'
和jni.srcDirs = []
。
请帮帮我。
10-06 02:20:10.021 25658-25658/com.renard.ocr I/NewDocumentActivity: available ram = 1253
10-06 02:20:10.022 25658-25658/com.renard.ocr I/LoggingAnalytics: startGallery
10-06 02:20:11.150 25658-25658/com.renard.ocr I/NewDocumentActivity: onSaveInstanceStatecom.renard.ocr.documents.viewing.grid.DocumentGridActivity@2089ff3a
10-06 02:20:11.158 25658-25658/com.renard.ocr I/MonitoredActivity: onStop: class com.renard.ocr.documents.viewing.grid.DocumentGridActivity
10-06 02:20:14.491 25658-25658/com.renard.ocr I/LoggingAnalytics: sendScreenView Document Grid
10-06 02:20:14.492 25658-25658/com.renard.ocr I/DocumentGridActivity: Permission Granted
10-06 02:20:14.521 25658-25658/com.renard.ocr I/NewDocumentActivity: registerImageLoaderReceiver com.renard.ocr.documents.creation.NewDocumentActivity$1@2957cb
10-06 02:20:14.526 25658-25658/com.renard.ocr I/ImageLoadAsyncTask: onPreExecute
10-06 02:20:14.539 25658-25658/com.renard.ocr I/NewDocumentActivity: onReceive com.renard.ocr.documents.viewing.grid.DocumentGridActivity@2089ff3a
10-06 02:20:14.539 25658-25658/com.renard.ocr I/NewDocumentActivity: showLoadingImageProgressDialog
10-06 02:20:14.543 25658-25862/com.renard.ocr E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.renard.ocr, PID: 25658
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-xz-1.2_f5d41baa4b0e66f7ff011968f621659dcaa8656c-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-support-annotations-23.2.1_efd358856f7349d1a9ffd2b176d6d830be5c44c9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-picasso-2.5.2_67292ac2af28944286798adb005d99de9c2ae1af-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-library-2.4.0_ba8a8c7617026b7f5ce1961782078a36c3ecabd1-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-leakcanary-watcher-1.3.1_3477fdf0dac26fb207fdd3116dc54932ca7cd475-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-leakcanary-analyzer-1.3.1_87b0c25fed029d3ca0c11998a503cd2916eee43d-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-jsr305-2.0.2_dbb7e003029ec987995ad97be3e462720c65b578-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.14_81a719a61cd451252aaf376417323ae6394ad9d3-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-internal_impl-23.2.1_7b0a9fc5574b04109287c4233aa0c9bd5c418e53-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-instant-run-bootstrap_02c3673e18eee0d4f569864fee4e9c324451500f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-haha-1.3_4a2fdd9f7e2899cc2002dc4ac35f1bc9784d2d79-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-guava-18.0_3525fe5c00f2742798282a55352f33c7a99c6c9a-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-eventbus-2.4.0_6a0d0f7c465fc084f0c4621db818ebeef8d8818f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-commons-compress-1.5_4f5179e5eab7e9c8df55dbc6ece6f942b0f0ebdf-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.viewpagerindicator-library-2.4.1_f674801ad2e7c42fdcfb11ab129d88386154ceee-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.squareup.leakcanary-leakcanary-android-1.3.1_ff82920667ff5ec1f6dccc58c5ed81c8650e86cb-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-8.4.0_7e1c16a5ecd5aadcd162511ebcc
10-06 02:20:14.543 25658-25862/com.renard.ocr D/Error: ERR: exClass=java.lang.UnsatisfiedLinkError
10-06 02:20:14.543 25658-25862/com.renard.ocr D/Error: ERR: exMsg=com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-xz-1.2_f5d41baa4b0e66f7ff011968f621659dcaa8656c-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-support-annotations-23.2.1_efd358856f7349d1a9ffd2b176d6d830be5c44c9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-picasso-2.5.2_67292ac2af28944286798adb005d99de9c2ae1af-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-library-2.4.0_ba8a8c7617026b7f5ce1961782078a36c3ecabd1-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-leakcanary-watcher-1.3.1_3477fdf0dac26fb207fdd3116dc54932ca7cd475-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-leakcanary-analyzer-1.3.1_87b0c25fed029d3ca0c11998a503cd2916eee43d-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-jsr305-2.0.2_dbb7e003029ec987995ad97be3e462720c65b578-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.14_81a719a61cd451252aaf376417323ae6394ad9d3-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-internal_impl-23.2.1_7b0a9fc5574b04109287c4233aa0c9bd5c418e53-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-instant-run-bootstrap_02c3673e18eee0d4f569864fee4e9c324451500f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-haha-1.3_4a2fdd9f7e2899cc2002dc4ac35f1bc9784d2d79-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-guava-18.0_3525fe5c00f2742798282a55352f33c7a99c6c9a-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-eventbus-2.4.0_6a0d0f7c465fc084f0c4621db818ebeef8d8818f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-commons-compress-1.5_4f5179e5eab7e9c8df55dbc6ece6f942b0f0ebdf-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.viewpagerindicator-library-2.4.1_f674801ad2e7c42fdcfb11ab129d88386154ceee-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.squareup.leakcanary-leakcanary-android-1.3.1_ff82920667ff5ec1f6dccc58c5ed81c8650e86cb-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-8.4.0_7e1c16a5ecd5aadcd162511ebcc96b65410697b9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.google.android.gms-play-services-analytics-8.4.0_a4131d10699c684fcc01190a9c95b7b43d893f97-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-ndk-1.1.2_63a8ca5e33f79d7a526f6c01592128421b46664f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-core-2.3.14_e3eeaf158c505e1121e51a570930e44e203f2779-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-2.6.5_98d575d65e651e4066ec8d119c0940998e648dc4-classes.dex", dex file "/da
10-06 02:20:14.543 25658-25862/com.renard.ocr D/Error: ERR: file=Runtime.java
10-06 02:20:14.543 25658-25862/com.renard.ocr D/Error: ERR: class=java.lang.Runtime
10-06 02:20:14.543 25658-25862/com.renard.ocr D/Error: ERR: method=loadLibrary line=366
10-06 02:20:14.543 25658-25862/com.renard.ocr D/Error: ERR: stack=java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-xz-1.2_f5d41baa4b0e66f7ff011968f621659dcaa8656c-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-support-annotations-23.2.1_efd358856f7349d1a9ffd2b176d6d830be5c44c9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-picasso-2.5.2_67292ac2af28944286798adb005d99de9c2ae1af-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-library-2.4.0_ba8a8c7617026b7f5ce1961782078a36c3ecabd1-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-leakcanary-watcher-1.3.1_3477fdf0dac26fb207fdd3116dc54932ca7cd475-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-leakcanary-analyzer-1.3.1_87b0c25fed029d3ca0c11998a503cd2916eee43d-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-jsr305-2.0.2_dbb7e003029ec987995ad97be3e462720c65b578-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.14_81a719a61cd451252aaf376417323ae6394ad9d3-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-internal_impl-23.2.1_7b0a9fc5574b04109287c4233aa0c9bd5c418e53-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-instant-run-bootstrap_02c3673e18eee0d4f569864fee4e9c324451500f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-haha-1.3_4a2fdd9f7e2899cc2002dc4ac35f1bc9784d2d79-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-guava-18.0_3525fe5c00f2742798282a55352f33c7a99c6c9a-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-eventbus-2.4.0_6a0d0f7c465fc084f0c4621db818ebeef8d8818f-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-commons-compress-1.5_4f5179e5eab7e9c8df55dbc6ece6f942b0f0ebdf-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.viewpagerindicator-library-2.4.1_f674801ad2e7c42fdcfb11ab129d88386154ceee-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.squareup.leakcanary-leakcanary-android-1.3.1_ff82920667ff5ec1f6dccc58c5ed81c8650e86cb-classes.dex", dex file "/data/data/com.renard.ocr/files/instant-run/dex/slice-com.google.android.gms-play-services-basement-8.4.0_7e1c16a5ecd5aadcd162511ebcc96b65410697b9-classes.dex", dex file "/data/data/com.renard.ocr/
10-06 02:20:14.544 25658-25862/com.renard.ocr D/Error: ERR: TOTAL BYTES WRITTEN: 26756
10-06 02:20:15.333 25658-25658/com.renard.ocr I/MonitoredActivity: onStop: class com.renard.ocr.documents.viewing.grid.DocumentGridActivity
10-06 02:20:15.386 25658-25658/com.renard.ocr I/NewDocumentActivity: unRegisterImageLoadedReceiver com.renard.ocr.documents.creation.NewDocumentActivity$1@2957cb
10-06 02:20:20.349 25658-25668/com.renard.ocr W/CursorWrapperInner: Cursor finalized without prior close()
答案 0 :(得分:0)
如果我理解,你在src / main / libs / a.png中有图像。
试用资产 - >的src /主/资产/ a.png
Bitmap bitmap = BitmapFactory.decodeStream(activity.getAssets().open("a.png")));
如果你有几个:
String[] S = activity.getAssets().list("");
for (int i = 0; i < S.length; i++) {
Bitmap bitmap = BitmapFactory.decodeStream(activity.getAssets().open(S[i])));
}
祝你好运。