Open Jaymin97 opened 5 years ago
I have the same issue, however, for me the issue only occurs when I add "implementation 'org.tensorflow:tensorflow-lite:+'" to my app build.gradle dependencies.
@SandroMachado it looks like you found the solution to this error back in 2015. Do you still remember what the cause was?
@collinspeight do you mind walking me through exactly how you got the basics to work. At the moment I've followed all the steps (not sure if I'm doing so correctly) and I keep getting this error. I would greatly appreciate your help. Thanks
i solved the issue by adding this to my apps gradle:
android { defaultConfig { ndk { abiFilters "armeabi-v7a" } } }
@android-dataticket Thanks for your reply, I added this and synced the gradle files however, when trying to run on emulator I get the following error and the emulator cannot start: "device supports x86 but apk only supports armeabi-v7a"
Would appreciate any further help, thanks
@Jaymin97 The default Android emulator uses the x86 architecture, however because abiFilters is setting the supported architecture to armeabi-v7a, it will no longer work. You can create a new virtual device with the armeabi-v7a architecture in Android studio, however this emulator will run incredibly slow. I would recommend developing with an actual Android device as almost all of them utilize the armeabi-v7a architecture these days.
@collinspeight Thanks for your reply, tried running it on my android device and it does work however I get the following error after trying to print this line :
String result = OpenALPR.Factory.create(MainActivity.this, ANDROID_DATA_DIR).recognizeWithCountryRegionNConfig("us", "", image.getAbsolutePath(), openAlprConfFile, 10);
Prints this : {"error":true,"msg":"Error initializing OpenAlpr"}
@collinspeight Sorry, I have now solved the above error, however the String 'result' does not contain any value.
I had this error when I was adding pytorch_android to my project. I needed to change abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
to abiFilters += listOf("armeabi-v7a")
to solve the issue. Otherwise the .so file were not in the right folder (armeabi-v7a). You can see it with the APK analyser
I had the same error. I need to add android{ ndk{ abiFilters.add("armeabi-v7a") } }
in app: build.gradle file in latest Android studio. This solved my problem.
Followed tutorial given but keep getting this error. Have tried looking at other issues posted her with same problem but to no avail. The directory I've given is the one where the project is saved and I've put the conf file in the correct place with the runtime_dir as the project directory. Not sure what the problem could be.
Full error:
2019-02-06 18:59:17.365 27216-27216/com.example.flaymin.supercarspotter E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.flaymin.supercarspotter, PID: 27216 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/base.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_resources_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.flaymin.supercarspotter-h436LlIP3tiMAhwzGo2pwQ==/lib/x86, /system/lib]]] couldn't find "libopenalpr-native.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1012) at java.lang.System.loadLibrary(System.java:1669) at org.openalpr.AlprJNIWrapper.(AlprJNIWrapper.java:9)
at org.openalpr.OpenALPR$Factory.create(OpenALPR.java:80)
at com.example.flaymin.supercarspotter.UploadActivity.onCreate(UploadActivity.java:172)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)