Open jiang99357 opened 1 month ago
build.gradle: import java.security.MessageDigest apply plugin: 'com.android.application' android { namespace 'com.baidu.paddle.lite.demo.ocr' compileSdkVersion 34 defaultConfig { applicationId "com.baidu.paddle.lite.demo.ocr" minSdkVersion 23 targetSdkVersion 34 versionCode 2 versionName "2.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { cppFlags "-std=c++11 -frtti -fexceptions -Wno-format" arguments '-DANDROID_PLATFORM=android-23', '-DANDROID_STL=c++_shared' ,"-DANDROID_ARM_NEON=TRUE" abiFilters 'arm64-v8a','x86' } } } ndkVersion = "21.1.6352462" buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" version "3.10.2" } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.test.ext:junit:1.2.1' implementation files('PaddleLite\\java\\PaddlePredictor.jar') implementation 'com.google.android.material:material:1.12.0' implementation 'androidx.activity:activity:1.9.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test:runner:1.5.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' } 报错: Process: com.baidu.paddle.lite.demo.ocr, PID: 12320 java.lang.RuntimeException: Load libNative.so failed, please check it exists in apk file. at com.baidu.paddle.lite.demo.ocr.OCRPredictorNative.loadLibrary(OCRPredictorNative.java:18) at com.baidu.paddle.lite.demo.ocr.OCRPredictorNative.<init>(OCRPredictorNative.java:31) at com.baidu.paddle.lite.demo.ocr.Predictor.loadModel(Predictor.java:93) at com.baidu.paddle.lite.demo.ocr.Predictor.init(Predictor.java:46) at com.baidu.paddle.lite.demo.ocr.Predictor.init(Predictor.java:57) at com.baidu.paddle.lite.demo.ocr.MainActivity.onLoadModel(MainActivity.java:242) at com.baidu.paddle.lite.demo.ocr.MainActivity$2.handleMessage(MainActivity.java:158) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libNative.so" not found at java.lang.Runtime.loadLibrary0(Runtime.java:1077) at java.lang.Runtime.loadLibrary0(Runtime.java:998) at java.lang.System.loadLibrary(System.java:1661) at com.baidu.paddle.lite.demo.ocr.OCRPredictorNative.loadLibrary(OCRPredictorNative.java:16) at com.baidu.paddle.lite.demo.ocr.OCRPredictorNative.<init>(OCRPredictorNative.java:31) at com.baidu.paddle.lite.demo.ocr.Predictor.loadModel(Predictor.java:93) at com.baidu.paddle.lite.demo.ocr.Predictor.init(Predictor.java:46) at com.baidu.paddle.lite.demo.ocr.Predictor.init(Predictor.java:57) at com.baidu.paddle.lite.demo.ocr.MainActivity.onLoadModel(MainActivity.java:242) at com.baidu.paddle.lite.demo.ocr.MainActivity$2.handleMessage(MainActivity.java:158) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.os.HandlerThread.run(HandlerThread.java:67)
是java版本的问题吗? libNative.so找不到
下载的Android dome2.8.1
是java版本的问题吗? libNative.so找不到