mp4parser runs on device from Android Studio but crashes when manually installing the APK
Asked Answered
F

4

9

I'm using mp4parser to merge videos. The app runs perfect when running from A.S. but if I install the app manually (transfer and run the APK) or if I run it from TestFairy, the app crashes.

This started happening when I updated my Target Sdk to Lollipop. I've added the

`aspectjrt-1.7.3.jar` 
`isoparser-1.0-RC-27.jar` 

into the libs dir in my project.

I've also tried with below versions

`aspectjrt-1.8.5.jar` 
`isoparser-1.0-RC-37.jar`
`isoparser-1.0.6.jar`.

Not sure if its the right way but it works from Android Studio then crashes from TestFairy or Manual install.

The error says

com.coremedia.iso.boxes.FileTypeBox missing

but its there in the isoparser jar.

What am I missing, is this a version issue?

My device is running Android 4.2.2 could this also be a problem if my target SDK is Android 5.0

The exception is:

Caused by: java.lang.ClassNotFoundException:com.coremedia.iso.boxes.FileTypeBox
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.coremedia.iso.boxes.FileTypeBox" on path: /data/app/com.myapp.appname-1.apk
Felicific answered 19/5, 2015 at 9:13 Comment(4)
In Android 4.2.2 Mp4 parser not working properly please try other versionClisthenes
Awesome, thank you for the quick response. Ok, so there's nothing I can do for users who have 4.2.2 installed, I have a S4 mini and 4.2.2 is the latest version available. If this is the case is there another 3rd party lib that works in 4.2.2 to merge videos?Felicific
Hi @sukumar, thanks again for your response, I have searched but cant find anything relating to Android 4.2.2 and mp4parser issue or any help in resolving this issue, It is important for us to run on Jellybean so I need to find something, If you have any more info on this. I'm currently considering using something like ffmpeg or Intel INDE Media for Mobile but both seem to be more time consuming. Any advice would be appreciated.Felicific
seems like a proguard problem, did you check your proguard file?Channel
F
1

Sorry late answer, I found after much frustration, that gradle was not packaging my lib files in the apk, it had nothing to do with mp4Parser, eventually after updating Android Studio, all SDK's and Gradle the apk packaged properly.

Felicific answered 10/6, 2015 at 21:8 Comment(1)
I am facing the same problem , and nothing is working right now . Can you tell which android studio version you upgraded?.Cheeks
D
0

Whenever you get a ClassNotFound exception your classloader can't find the class it needs to operate. It has nothing to do with MP4 parser not working on 4.2.2 as suggested above.

Do you use Gradle? Is the class bundled as a library in your gradle build file?

Try to add this under dependencies { } in your app's build.gradle file:

  compile fileTree(dir: 'libs', include: '*.jar')

This will include all the jar-files in your libs folder in the final build.

Dorothi answered 27/5, 2015 at 10:21 Comment(2)
Hi @DKIT, Thanks for the response, I'm using Gradle, and I already have compile fileTree(dir: 'libs', include: '*.jar') in my build.gradle in dependencies. but I still get the error: java.lang.ClassNotFoundException: Didn't find class "com.coremedia.iso.boxes.FileTypeBox" on path: DexPathList[[zip file "/data/app/com.example.appname-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.appname-1, /vendor/lib, /system/lib]]Felicific
OK - did you add this dependency to the app itself, or to a module the app depends on? Android needs to have the dependency in the libs-directory under the app directory itself to find it.Dorothi
T
0

Add these 2 lines in your proguard-rules.pro. This worked for me.

-keep class com.coremedia.iso.boxes.** { *; }
-keep class com.googlecode.mp4parser.boxes.mp4.ESDescriptorBox { *; }

make your build.gradle to use proguard-rules.pro like this :

android {
 buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Telephone answered 13/5, 2016 at 10:36 Comment(0)
K
0

Try to clear Target Annotations code in your mp4parser class

Kelula answered 24/9, 2019 at 9:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.