Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Support 16KB Page Size #294

Closed
mhdjazmati opened this issue Nov 20, 2024 · 6 comments · Fixed by #295
Closed

[Android] Support 16KB Page Size #294

mhdjazmati opened this issue Nov 20, 2024 · 6 comments · Fixed by #295
Labels
android bug Something isn't working

Comments

@mhdjazmati
Copy link

mhdjazmati commented Nov 20, 2024

Describe the bug

final img = await cv.imreadAsync(imagePath, flags: cv.IMREAD_GRAYSCALE);

when it goes here it will crash with exception:

Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libdartcv.so': dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/~~6THc7nmbhNWQ1qGf0VwAkQ==/com.example.opencv_oc-Rn_I_jOHmr7ZXoEHurFG1Q==/base.apk!/lib/arm64-v8a/libdartcv.so" (new hash type from the future?)

keep in mind this is my arm64-v8a folder:
libavcodec.so
libavformat.so
libswresample.so
libavfilter.so
libavutil.so
libswscale.so

also when i try to run the command:
dart run opencv_dart:setup android -a arm64-v8a -f
i got error : Could not find bin/setup.dart in package opencv_dart.

keep in mind on MacOS platform it is working

To Reproduce
Steps to reproduce the behavior:
just make new project add lib to pubspec, run with the example code.

Desktop (please complete the following information):

  • OS: android

Smartphone (please complete the following information):

  • Device: emulator
  • ABI Version arm64-v8a
@mhdjazmati mhdjazmati added the bug Something isn't working label Nov 20, 2024
@rainyl
Copy link
Owner

rainyl commented Nov 21, 2024

@mhdjazmati I can't reproduce it with Android API level 34, are you using Android 35?

also when i try to run the command:
dart run opencv_dart:setup android -a arm64-v8a -f
i got error : Could not find bin/setup.dart in package opencv_dart.

Since v1.3.0, the setup commands have been deprecated, because the libdartcv will be build locally.

Also, it would be helpful if you can attach the compiled libdartcv.so, you can find it in build/app/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a

Related:

@mhdjazmati
Copy link
Author

android {
    namespace = "com.example.opencv_oc"
    compileSdk = flutter.compileSdkVersion
    ndkVersion "25.1.8937393"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = 17
    }

    defaultConfig {
        minSdk = 26
        targetSdk = 34
        versionCode = flutter.versionCode
        versionName = flutter.versionName
        applicationId = "com.example.opencv_oc"
    }

    buildTypes {
        release {
            signingConfig = signingConfigs.debug
        }
    }
}
Screenshot 2024-11-21 at 1 15 07 PM

this is the size of it for it and i attached it as zip
Uploading libdartcv.so.zip…

@mhdjazmati
Copy link
Author

also my emulator api is 35

@mhdjazmati
Copy link
Author

mhdjazmati commented Nov 21, 2024

Screenshot 2024-11-21 at 1 28 35 PM

is this the issue ? the emulator?

@rainyl
Copy link
Owner

rainyl commented Nov 21, 2024

is this the issue ? the emulator?

Very likely, there are many similiar issues about 16KB page size:

@rainyl
Copy link
Owner

rainyl commented Nov 21, 2024

I have reproduced the bug using API 35 with 16KB page size, will look into and try to fix it.

For now, please use emulators without 16KB Page Size

@rainyl rainyl changed the title i'm not able ti use the lib, Failed to load dynamic library 'libdartcv.so' [Android] Support 16KB Page Size Nov 21, 2024
@rainyl rainyl added the android label Nov 21, 2024
rainyl added a commit that referenced this issue Nov 22, 2024
fix [Android] Support 16KB Page Size #294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants