Cannot include FFmpegMediaPlayer lib in my android project - android

I've to include in my Android studio project a lib for managing audio streams from urls. I'm tying to use this, but when I try to run the app and it reach the point where have to instantiate a FFmpegMediaPlayer object, it crush with the error
31444-31444/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
These the steps I've done to integrate the lib in my project:
I've copied all .so, gdb.setup and gdbserver files from demo project and put them into my jniLibs replicating the exact folder structure
I've copied fmp.jar from demo my libs forlder
I've changed all paths in gdb.setup files accordingly with my project folder structure
synch with gradle
I'm not an expert of Android specially for tasks like this, am I missing something important? If you need it I can give a test app
Thankyou
Edit 1
This is the complete error
08-19 10:20:42.066 31444-31444/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.example.lucabrognara.radiostreamprova.RadioActivity.onCreate(RadioActivity.java:126)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
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:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1892]: 1836 could not load needed library 'libswresample.so' for 'libavcodec.so' (load_library[1094]: Library 'libswresample.so' not found)
at java.lang.Runtime.load(Runtime.java:340)
at java.lang.System.load(System.java:521)
at wseemann.media.FFmpegMediaPlayer.<clinit>(FFmpegMediaPlayer.java:604)
            at com.example.lucabrognara.radiostreamprova.RadioActivity.onCreate(RadioActivity.java:126)
            at android.app.Activity.performCreate(Activity.java:5206)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
            at android.app.ActivityThread.access$700(ActivityThread.java:140)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4921)
            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:1027)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
            at dalvik.system.NativeStart.main(Native Method)

Obviously, it was sufficient read carefully the documentation:
If you don't want to build the modules you can simple unzip the prebuilt ones and copy them to your projects "libs" folder
These the right steps:
Create an android studio project
unzip the prebuilt modules in jniLibs folder
put the fmp.jar file in libs folder
obviously include the android.permission.INTERNET in your manifest

Related

Why my app crashes when I launch it on android studio 1.2 but not in android studio 2.0 Preview

When I launch my app on device with android studio 2.0 Preview it works fine, but then when I open android studio 1.2 and try to launch it , it doesnt Launch and it crashes? Does anyone have same problem or know how to fix this ?
I get this error:
12-23 09:41:14.023 26953-26953/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication
at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4170)
at android.app.ActivityThread.access$1400(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
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:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4170)
            at android.app.ActivityThread.access$1400(ActivityThread.java:134)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4867)
            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:1007)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
            at dalvik.system.NativeStart.main(Native Method)
12-23 09:41:14.083 2025-2049/? E/android.os.Debug﹕ !#Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
The problem probably occurs because of your android build tools and/or gradle configuration.
Can you check/change:
The classpath of the android build tool you are using to build the app (e.g: classpath 'com.android.tools.build:gradle:1.2.3')
The buildToolVersion of your gradle script (e.g: buildToolsVersion '23.0.2')
And finally if all these informations seems OK for you, you can check in this file <project folder>/.idea/gradle.xml the gradle_home.
e.g:
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.4" />

Android Navigation Drawer with Page Sliding tab Strip

I'm trying to use Android Navigation Drawer with Page (Pager) Sliding tab Strip (https://github.com/Balaji-K13/Navigation-drawer-page-sliding-tab-strip), but i couldn't make it work. I'm using android studio. I made the imports in main project, and doesn't show any error, but when i run into a device (virtual or real) get this error:
05-22 10:38:20.200 1434-1434/com.webileapps.navdrawer E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.webileapps.navdrawer, PID: 1434
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.webileapps.navdrawer/com.webileapps.navdrawer.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.webileapps.navdrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.webileapps.navdrawer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.webileapps.navdrawer-1, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2102)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.access$700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
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:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.webileapps.navdrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.webileapps.navdrawer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.webileapps.navdrawer-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2093)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
            at android.app.ActivityThread.access$700(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4998)
            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:777)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
            at dalvik.system.NativeStart.main(Native Method)
So, thoughts?
I was also trying to implement it and got the same error .After lot of effort I was able to run it but received the similar error as you have received .
I resolved the issue by
1:Close and start your eclipse .
2: copying the v4 jar of main project in all the library projects and deleting the existing ones .
The error comes due to mismatch of supportv4jar. Make all the supportv4jar of same version
3:after that Delete the gen and bin folder and clean the project and run .

RenderScript Support Library crashes on x86 devices

I'm getting FATAL EXCEPTION running android.support.v8.renderscript.* on Razor i, a x86 device. The problem goes away if I use android.renderscript.* Also there is not problem with ARM devices. Here is the exception:
03-03 18:35:26.009 25011-25011/com.example.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 143 cannot locate '__strlen_chk'...
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
at android.app.ActivityThread.access$700(ActivityThread.java:137)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5031)
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:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 143 cannot locate '__strlen_chk'...
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:945)
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:982)
at android.support.v8.renderscript.RenderScript.create(RenderScript.java:968)
at com.example.app.MainActivity$PlaceholderFragment.createScript(MainActivity.java:92)
at com.example.app.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:81)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
at android.app.BackStackRecord.run(BackStackRecord.java:635)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
at android.app.Activity.performStart(Activity.java:5067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2088)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2153)
            at android.app.ActivityThread.access$700(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5031)
            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:792)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
            at dalvik.system.NativeStart.main(Native Method)
I meet the same issue when I using Build Tools 21.1.1 and proguard, you may need to use the following proguard settings:
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class android.support.v8.renderscript.** { *; }
For more infomation: Using the Android Renderscript v8 Support Library
With Build Tools 21.1.1 this issue disappear.
I think you should also include the native libraries from \build-tools\19.0.2\renderscript\lib\packaged

GCM issues on the android client

I have an android app that was working previously, I had to set up the dev environment on a new PC. Everything compiles fine (i'm using Android Studio), but I get the following error:
11-26 15:25:22.737 15132-15132/com.sample E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gcm.GCMRegistrar
at com.sample.views.loginregistration.LoginManager.handleRegistration(LoginManager.java:147)
at com.sample.views.loginregistration.LoginViewFragment.onCreateView(LoginViewFragment.java:74)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:523)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
It's saying it cannot find gcm.jar which is clearly in the project and in a folder called libs. These were the common issues that people reported in other SO posts. The app basically launches and then crashes on the spot... But i'm confused as the setup is correct.
Is there anything else that could be wrong with this?
It might be a build.gradle issue. You should have this in your build.gradle file
dependencies {
compile files('libs/gcm.jar')
}
Once you've added that, go to Tools -> Android -> Sync Project with Gradle Files

java.lang.NoClassDefFoundError for a class in the project

Android is throwing NoClassDefFoundError for ~1% of my users, no specific SDK version.
It's happening In my activity in the onCreate function when it try's to get an instance to a Singleton class i have in my project.
The singleton class it self doesn't reference any libs jar.
I tried on same devices it's heppening (e.g. SGH-T989) with no success.
Edit: adding the stack trace
at com.myapp.activities.RootActivity.getLoaderInstance(RootActivity.java:450)
at com.myapp.activities.RootActivity.doOnCreate(RootActivity.java:215)
at com.myapp.android.activities.AbstractActivity.onCreate(AbstractActivity.java:130)
at android.app.Activity.performCreate(Activity.java:5188)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4938)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)

Categories

Resources