Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:18:57+00:00 2026-06-02T19:18:57+00:00

I am new in the developing for Android and I faced with next problem:

  • 0

I am new in the developing for Android and I faced with next problem:
when I using C++ code that uses “dynamic_cast” expressions – “UnsatisfiedLinkError” appears when I am starting my application on an emulator. But when I run application without it – all works OK( I mean without any errors to LogCat )

I tried to run it on Android 2.3.3. I used android-ndk-r7b.

My Application.mk:

APP_OPTIM := debug
APP_ABI := armeabi
APP_STL := gnustl_static
APP_MODULES := native_lab

My Android.mk:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := native_lab
LOCAL_SRC_FILES := native.cpp enum_if.cpp torrent.cpp
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_LDLIBS := -llog -lz \
    /home/l/android9_toolchain/arm-linux-androideabi/lib/libstdc++.a
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)

The pieces of code that uses dynamic cast:

namespace libtorrent 
{
    template <class T>
    T* alert_cast(alert* a)
    {
        return dynamic_cast<T*>(a);
    }
}
.....

using namespace libtorrent;
if (torrent_finished_alert* p = alert_cast<torrent_finished_alert>(a)){}

Log cat says:

03-27 07:28:26.465: D/dalvikvm(404): Trying to load lib /data/data/com.example/lib/libnative_lab.so 0x405149b8
03-27 07:28:26.496: W/dalvikvm(404): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/example/Bt2Activity;
03-27 07:28:26.555: W/dalvikvm(404): Class init failed in newInstance call (Lcom/example/Bt2Activity;)
03-27 07:28:26.555: D/AndroidRuntime(404): Shutting down VM
03-27 07:28:26.575: W/dalvikvm(404): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-27 07:28:26.615: E/AndroidRuntime(404): FATAL EXCEPTION: main
03-27 07:28:26.615: E/AndroidRuntime(404): java.lang.ExceptionInInitializerError
03-27 07:28:26.615: E/AndroidRuntime(404):  at java.lang.Class.newInstanceImpl(Native Method)

Do anybody know how to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:18:58+00:00Added an answer on June 2, 2026 at 7:18 pm

    Try to include these lines into your Applications.mk:

    APP_CPPFLAGS += -frtti 
    APP_CPPFLAGS += -fexceptions
    

    Do you have any methods in Java marked as ‘native’?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing Android application where I use this code: Date d=new Date(new
I am new to phonegap.I am using jquery mobile with html5 for developing android
I'm new to developing apps in Android. We are currently creating a robot using
I am new in developing android applications. I want to create an android application(using
I'm developing an Android application and I have a problem running a new thread
I'm new to android developing but right now I'm working on an application that
I'm new in Java. I'm developing program for Android similar to app for iOS.
I am very new to android and I am developing this app which allows
i am new bie in android, I am developing an application in Android, and
I'm configuring a new Developing Server that came with Windows 7 64bits. It must

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.