Giter VIP home page Giter VIP logo

android-ndk-rs's People

Contributors

mb64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

android-ndk-rs's Issues

Giving up jni crate in favor to jny-sys

Since currently different alternatives to jni crate can be used for interfacing with java runtime I propose avoid jni wrappers in favor low level jni-sys types.

dlopen failed: cannot locate symbol "AConfiguration_getScreenRound"

Hey there! thanks for this library!

I ran into this issue, possibly related to my build process, when I build some code using android_ndk. When I add android_ndk My .so file now has the symbol AConfiguration_getScreenRound. Which makes sense because you create the bindings for android/configuration. But Android can't seem to find the thing to link it to!

I also get this issue when adding AConfiguration_getScreenRound(state->config) to the native-activity sample in ndk-samples.

Maybe I didn't link some library? I looked at the symbols in all of the lib*.so in the ndk and I didn't see a symbol for AConfiguration_getScreenRound either (but I see symbols for AConfiguration_getScreenLong). So I don't think I'm forgetting to link something.

Maybe if you too can't get it working, then AConfiguration_getScreenRound should be behind a cargo feature?

Or am I missing something really obvious?

Error 'use of invalid object' when any attempts ot interacting with activity instance using JNI

I don't sure, this problem actually related to android-ndk-sys nor jni crate but it looks very strange for me.
Also I don't quite familiar with JNI, so I may do wrong things here.

My rust code looks like a piece below:

    let app = unsafe { AndroidApp::from_ptr(android_glue::get_android_app()) };
    let activity = app.activity();

    let sdk_version = activity.sdk_version();
    println!("SDK VERSION: {}", sdk_version);

    let env = vm.attach_current_thread()?;
    println!("ENV: {:?}", env.get_version());

    println!("Activity: {:?}", activity);

    let class = env.find_class("android/app/NativeActivity")?;
    println!("Found NativeActivity class: {:?}", class);

    let class = env.get_object_class(activity)?;
    println!("Actual Activity class: {:?}", class);

But application failed on last line.

12-30 21:33:17.419 10414 10429 D RustStdoutStderr: SDK VERSION: 28
12-30 21:33:17.420 10414 10429 D RustStdoutStderr: ENV: Ok(V6)
12-30 21:33:17.420 10414 10429 D RustStdoutStderr: Activity: JObject { internal: 0x99f0a60c, lifetime: PhantomData }
12-30 21:33:17.420 10414 10429 D RustStdoutStderr: Found NativeActivity class: JClass(JObject { internal: 0x1, lifetime: PhantomData })
12-30 21:33:17.522 10414 10430 F .rust_oboe_dem: java_vm_ext.cc:542] JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0x99f0a60c

It seems, activity instance object is invalid.
But I understand that it may not be what it seems.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.