我在我的应用程序中使用 Javascript 接口。
当我在我的设备(Galaxy 3)上运行调试时,它运行完美,没有任何问题,但是当我制作发布 apk 文件时,JavaScript 可能没有运行。
这是JavaScriptInterface
类:
public class StreamingMediaPlayer{
public class JavaScriptInterface {
Context mContext;
JavaScriptInterface(Context c) {
mContext = c;
}
@JavascriptInterface
public void FinishExtract(String url) {
}
}
}
现在我认为这是因为proguard文件:
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn org.apache.commons.codec.binary.**
-dontwarn com.commonsware.cwac.sacklist.**
-dontwarn com.commonsware.cwac.tlv.**
-dontwarn com.nineoldandroids.**
-dontwarn com.apps.model.**
-keep class com.millennialmedia.android.** {*;}
-keep public class cmn.Proguard$KeepMembers
-keep public class * implements cmn.Proguard$KeepMembers
-keepclassmembers class * implements cmn.Proguard$KeepMembers {
<methods>;
}
-keepattributes *Annotation*
-dontwarn android.webkit.JavascriptInterface
-keep class com.apps.model.** { *; }
-keepattributes *Annotation*
我需要在proguard
文件中添加一些东西吗?问题可能是其他问题吗?