У меня возникают проблемы с Proguard и моим пользовательским VideoView для моего приложения. Кажется, что запутывание моего кода вызывает проблемы с моим VideoView. Всякий раз, когда я пытаюсь установить OnPreparedListener для видео, мое приложение выходит из строя. См:
11-13 15:54:45.881 19428-19428/com.<REDACTED> E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.<REDACTED>, PID: 19428
java.lang.NoSuchMethodError: No virtual method setOnPreparedListener(Landroid/media/MediaPlayer$e;)V in class Landroid/widget/VideoView; or its super classes (declaration of 'android.widget.VideoView' appears in /system/framework/framework.jar:classes2.dex)
at com.<REDACTED>.ui.module.MHVideoPlayerModule.initializeVideoPlayer(MHVideoPlayerModule.java:174)
at com.<REDACTED>.ui.module.MHVideoPlayerModule.initializeViewData(MHVideoPlayerModule.java:154)
at com.<REDACTED>.ui.activity.MHVideoDetailActivity.a(MHVideoDetailActivity.java:198)
at com.<REDACTED>.ui.activity.MHVideoDetailActivity.b(MHVideoDetailActivity.java:171)
at com.<REDACTED>.ui.activity.MHVideoDetailActivity.a_(MHVideoDetailActivity.java:255)
at com.<REDACTED>.service.f.al.b(MHVideoUrlTaskManager.java:131)
at com.<REDACTED>.service.a.e.onPostExecute(MHAsyncServiceTask.java:194)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
...
Я попытался добавить строки ниже в файл Proguard, но они не помогают.
-keep class com.<REDACTED>.ui.module.MHVideoPlayerModule { *; }
-keep class android.widget.VideoView { *; }
EDIT: Вот файл proguard-project.txt
:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class com.<REDACTED>.common.JavaScriptInterface {
public *;
}
# Google Play Services start
# https://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# Google Play Services end
-dontwarn javax.jdo.**
-dontwarn javax.naming.**
-dontwarn com.google.api.client.googleapis.extensions.android.gms.**
-dontwarn com.google.android.gms.**
-dontwarn com.squareup.okhttp.**
-keep public class android.net.http.SslError
-keep public class android.webkit.WebViewClient
-keep public class android.widget.VideoView
-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient
-dontwarn android.media.MediaPlayer
-dontwarn android.widget.VideoView
-dontwarn org.bouncycastle.**
-dontwarn org.apache.commons.codec.binary.Base64
-keepattributes SourceFile,LineNumberTable
-printusage build/outputs/proguard/unused.txt
-printconfiguration build/outputs/proguard/configuration.txt
-libraryjars libs
-keep class com.crashlytics.** { *; }
-keep class io.fabric.** { *; }
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class com.facebook.** { *; }
# New Relic start
# https://docs.newrelic.com/docs/mobile-monitoring/mobile-monitoring-installation/android/installing-android-apps-gradle-android-studio#proguard
-keep class com.newrelic.** { *; }
-dontwarn com.newrelic.**
-keepattributes Exceptions, Signature, InnerClasses
# New Relic end
-dontshrink