问题
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
回答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.
回答2:
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.
回答3:
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'
}
}
}
回答4:
Try to clear Target Annotations code in your mp4parser class
来源:https://stackoverflow.com/questions/30321373/mp4parser-runs-on-device-from-android-studio-but-crashes-when-manually-installin