I am using pjsua2 lib for voip calling and after building sample application there is a file named pjsua2.so has been created in lib->armebie folder .Now this sample application is running well in version 4.1.1 but same application crashing in version 2.2 and giving exception
04-05 13:27:11.936: W/dalvikvm(8936): VFY: unable to resolve virtual method 81: Ljava/lang/String;.isEmpty ()Z
04-05 13:27:12.236: W/dalvikvm(8936): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lorg/pjsip/pjsua2/app/MyApp;.<clinit>
04-05 13:27:12.236: W/dalvikvm(8936): threadid=1: thread exiting with uncaught exception (group=0x400207d8)
04-05 13:27:12.256: E/AndroidRuntime(8936): FATAL EXCEPTION: main
04-05 13:27:12.256: E/AndroidRuntime(8936): java.lang.ExceptionInInitializerError
04-05 13:27:12.256: E/AndroidRuntime(8936): at org.pjsip.pjsua2.app.MainActivity.onCreate(MainActivity.java:93)
04-05 13:27:12.256: E/AndroidRuntime(8936): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 13:27:12.256: E/AndroidRuntime(8936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2633)
04-05 13:27:12.256: E/AndroidRuntime(8936): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2685)
04-05 13:27:12.256: E/AndroidRuntime(8936): at android.app.ActivityThread.access$2300(ActivityThread.java:126)
04-05 13:27:12.256: E/AndroidRuntime(8936): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
So can any one tell me the issue ??
here is make file
include ../../../../../build.mak
LOCAL_PATH := $(PJDIR)/pjsip-apps/src/swig/java/android
include $(CLEAR_VARS)
LOCAL_MODULE := libpjsua2
LOCAL_CFLAGS := $(APP_CFLAGS) -frtti -fexceptions
LOCAL_LDFLAGS := $(APP_LDFLAGS)
LOCAL_LDLIBS := $(APP_LDLIBS)
LOCAL_SRC_FILES := ../output/pjsua2_wrap.cpp
include $(BUILD_SHARED_LIBRARY)
Your problem is related to the path of the pjsua2 library. Check in your source where you load the library. Try to add this static block a static :
static {
System.load("path to your library";
System.out.println("library loaded");
}
When you start to build PJSUA2 don't forget to build it for every armeabi you are going to use. For example: TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags.
Related
I am using ListViewAnimations core library version 3.1.0 in my android application. I have only included lib-core library as per the setup instructions. But unfortunately I am receiving following error java.lang.NoClassDefFoundError:
java.lang.NoClassDefFoundError: Failed resolution of: [Lcom/nineoldandroids/animation/Animator;
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at com.nhaarman.listviewanimations.appearance.AnimationAdapter.animateViewIfNecessary(AnimationAdapter.java:174)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at com.nhaarman.listviewanimations.appearance.AnimationAdapter.getView(AnimationAdapter.java:145)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2346)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.makeAndAddView(ListView.java:1875)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.fillDown(ListView.java:702)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.fillFromTop(ListView.java:763)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.ListView.layoutChildren(ListView.java:1684)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.AbsListView.onLayout(AbsListView.java:2148)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.view.View.layout(View.java:16630)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.view.ViewGroup.layout(ViewGroup.java:5437)
11-23 14:47:18.489 14928-14928/com.gi.giml E/AndroidRuntime: at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
I am using this animation library in my app like below:
ListView lv = new ListView(getActivity());
SwingBottomInAnimationAdapter bottomInAnimationAdapter = new SwingBottomInAnimationAdapter(new ArrayAdapter<String>(getActivity(), R.layout.subgroup_list_layout, R.id.textView, result));
bottomInAnimationAdapter.setAbsListView(lv);
lv.setAdapter(bottomInAnimationAdapter);
Any idea what I am doing wrong?
ListViewAnimations is based on NineOldAndroids and several classes reference com.nineoldandroids.animation.Animator directly. So you need to include this library as well.
If you're using gradle, this is done automatically by only declaring
dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
}
in your build.gradle. The same holds if you're using Maven and pom.xml. Otherwise you need to follow the instructions on the page you linked yourself:
Download the jar files you need: (lib-core)
Download the latest NineOldAndroids.jar file
Add the .jar files to your project's libs folder, or add them as external jars to your project's build path.
You should also include "nineoldandroids-2.4.0.jar" file in your project along with dependencies {
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0#aar'
}
add jar file to the lib folder and add this line in dependency
compile files('libs/nineoldandroids-2.4.0.jar') it works fine for this error "java.lang.NoClassDefFoundError: Failed resolution of: [Lcom/nineoldandroids/animation/Animator;"
link to download jar file https://github.com/downloads/JakeWharton/NineOldAndroids/nineoldandroids-2.4.0.jar
I'm using the application class , so I had to create the manifest file, as follows:
<application
android.name="com.moonae.android.common.ApplicationClass"
android.icon="#drawble/ic_launcher"
android.largeHeap="true"
....>
<activity..../>
I have to work normally without problems when testing , often the error occurred in the Google Play Store error report.
But the error report is posted on the Android version 4.4 , I even tested at 4.4 operate normally.
If the person experiencing this problem help me.
java.lang.RuntimeException: Unable to instantiate application com.moonae.android.common.ApplicationClass: java.lang.ClassNotFoundException: Didn't find class "com.culturelandnew.android.common.ApplicationClass" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4524)
at android.app.ActivityThread.access$1500(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.moonae.android.common.ApplicationClass" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:993)
at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
... 11 more
<application
android.name="com.moonae.android.common.ApplicationClass"
android.icon="#drawble/ic_launcher"
android.largeHeap="true"
....>
<activity..../>
is this a typo? i have not seen this before i mean android.name to android:name..btw
quick suggestion, remove your application tag, and use the eclipse gui side to search the application class and reference it.. mostly it references the it without package name included.. like this.. =>
<application
android:name="ApplicationClass"
android:icon="#drawble/ic_launcher"
android:largeHeap="true"
....>
I'm having trouble running the vitamio-sample from https://github.com/yixia/VitamioBundle.
I am building it with Android Studio and it compiles fine and runs, but when it gets to this line:
if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
return;
It throws an exception when I run it on my Nexus 5 (and also on a Galaxy S4):
01-22 11:58:40.759 12323-12323/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: io.vov.vitamio.demo, PID: 12323
java.lang.UnsatisfiedLinkError: Couldn't load vinit from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/io.vov.vitamio.demo-1.apk"],nativeLibraryDirectories=[/data/app-lib/io.vov.vitamio.demo-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at io.vov.vitamio.Vitamio.<clinit>(Vitamio.java:258)
at io.vov.vitamio.LibsChecker.checkVitamioLibs(LibsChecker.java:40)
at io.vov.vitamio.demo.VitamioListActivity.onCreate(VitamioListActivity.java:40)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
The exception also happens when I'm running the v4.2.0 tree in my own app.
Any idea what I'm missing? In my own app I pulled the vitamio project into a libraries folder and am referencing it like this:
compile(project(':libraries:vitamio'))
The sample project is left as-is.
I am not sure if there is a cleaner way in the newer version of Vitamino (or gradle). But here is how I got it to work with gradle build tools 0.6.
Added a project to my /libraries directory with the vitamino source/sdk. This has a /libs/armeabi /libs/armeabi-v7a with libvinit.so inside.
In my build.gradle for my main project, reference the library project like:
dependencies {
// other dependencies
compile(project(':libraries:vitamio'))
}
Add the following to the bottom of my build.gradle
task copyNativeLibs(type: Copy) {
from(new File(project(':libraries:vitamio').getProjectDir(), 'libs')) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir new File(buildDir, 'native-libs')
}
Then when i run a clean and rebuild it will copy the native libs to the proper spot and include them in the build.
I'm facing a strange issue when declaring a Content Provider in my project. I'm copying the classes and Manifest declaration from another project of my own. It's working OK on my other project.
Here's part of my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.qr"
android:installLocation="auto"
android:versionCode="540"
android:versionName="5.4" >
(...)
<application
android:name=".Application"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:logo="#drawable/ic_launch" >
(...)
<provider
android:name=".provider.HistoryProvider"
android:authorities="com.example.qr.History"
android:exported="true"
android:multiprocess="true"
android:readPermission="com.example.qr.History.read"
android:writePermission="com.example.qr.History.write" />
(...)
</application>
</manifest>
When I run my app, I get this stack trace:
FATAL EXCEPTION: main
java.lang.NullPointerException
at android.app.ActivityThread.installProvider(ActivityThread.java:4783)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4430)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
This is the whole stack trace. No 'com.example' trace is included. Of course some code in my app is producing this but the actual crash happens in Android.
Because my own classes are not included in the stack trace, I really don't know where to look.
I've run the code in an emulator with Android 4.2 and I've compared it with the source code of that version of Android, so I know the crash is produced in this line of ActivityThread:
4782 ApplicationInfo ai = info.applicationInfo;
4783 if (context.getPackageName().equals(ai.packageName)) {
Here's a link to the source code of this class.
If I don't declare the content provider (i.e. if I remove from my Manifest), the app works perfectly.
I've added some logs to my Application class, as well as the main Activity class. The crash is produced before either is launched.
So, my question is: what in my code can be producing context, context.getPackageName() or info.applicationInfo to be null during installation?
EDIT
When triggering the stack trace in the emulator several times, I only get this between traces:
09-11 23:10:21.250: E/AndroidRuntime(933): at dalvik.system.NativeStart.main(Native Method)
09-11 23:10:21.470: D/dalvikvm(933): GC_CONCURRENT freed 142K, 9% free 2951K/3224K, paused 78ms+3ms, total 225ms
09-11 23:10:44.030: I/Process(933): Sending signal. PID: 933 SIG: 9
09-11 23:10:46.940: D/dalvikvm(947): GC_CONCURRENT freed 164K, 10% free 2711K/2996K, paused 13ms+114ms, total 201ms
09-11 23:10:47.170: I/ActivityThread(947): Pub com.example.qr.History: com.example.qr.provider.HistoryProvider
09-11 23:10:47.170: D/AndroidRuntime(947): Shutting down VM
09-11 23:10:47.170: W/dalvikvm(947): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
09-11 23:10:47.180: E/AndroidRuntime(947): FATAL EXCEPTION: main
I have a problem regarding the ksoap2. My problem is that the project used to work well up to the time that I had to format my pc and set it up again.
I don't remember what version I had referenced in my application but I tried many of them and the problem still occurs.
04-05 13:56:18.289: E/dalvikvm(495): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.giatrosofia.Activity_Votana$ConnectAndGetLst.doInBackground
04-05 13:56:18.289: W/dalvikvm(495): VFY: unable to resolve new-instance 223 (Lorg/ksoap2/serialization/SoapObject;) in Lcom/giatrosofia/Activity_Votana$ConnectAndGetLst;
04-05 13:56:18.289: D/dalvikvm(495): VFY: replacing opcode 0x22 at 0x0000
04-05 13:56:29.627: W/dalvikvm(495): threadid=9: thread exiting with uncaught exception (group=0x40014760)
04-05 13:56:29.809: E/AndroidRuntime(495): FATAL EXCEPTION: AsyncTask #1
04-05 13:56:29.809: E/AndroidRuntime(495): java.lang.RuntimeException: An error occured while executing doInBackground()
04-05 13:56:29.809: E/AndroidRuntime(495): at android.os.AsyncTask$3.done(AsyncTask.java:266)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
04-05 13:56:29.809: E/AndroidRuntime(495): at java.lang.Thread.run(Thread.java:1020)
04-05 13:56:29.809: E/AndroidRuntime(495): Caused by: java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
The referenced file is ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar
and the excpetion occured in
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
Here are the referenced jar files
Am I missing someging?
if you are using new ADT 17
then create one directory on root of your project named libs
and just copy and paste ksop jar into libs dir.
res
bin
libs --> your.jar file here
as new updated it will work well.
You can try to add the KSOAP2 to your "Order and Export" tab. To do that:
01- Right click on the name of your project
02- Click on Properties
03- Select Java Build Path
04- Check if the KSOAP Library is already on the Libraries Tab
05- Click on the Order and Export tab and check the checkbox next to ksoap2-android-assembly.
Export your project again and try it. It should work now.