我正在尝试从URL导入PAC文件并以编程方式更改Wifi代理设置。我找到了这个proxy-vole,但是当我尝试使用pac url初始化ProxySelector时,返回null:
UrlPacScriptSource source = new UrlPacScriptSource("http://www.example.org/proxy.pac");
PacProxySelector selector = new PacProxySelector(source);
ProxySelector.setDefault(selector);
项目:
Method threw 'java.lang.NoClassDefFoundError' exception.
Stacktrace:
2019-03-14 12:02:58.437 9662-9662/mobile.betblocker E/AndroidRuntime: FATAL EXCEPTION: main
Process: mobile.betblocker, PID: 9662
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/mozilla/javascript/ScriptableObject;
at com.btr.proxy.selector.pac.PacProxySelector.selectEngine(PacProxySelector.java:76)
at com.btr.proxy.selector.pac.PacProxySelector.<init>(PacProxySelector.java:40)
at mobile.betblocker.SplashScreenActivity.onCreate(SplashScreenActivity.java:77)
at android.app.Activity.performCreate(Activity.java:7183)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.mozilla.javascript.ScriptableObject" on path: DexPathList[[zip file "/data/app/mobile.betblocker-2q0r6WOyKpqIgRDwtWOl7Q==/base.apk"],nativeLibraryDirectories=[/data/app/mobile.betblocker-2q0r6WOyKpqIgRDwtWOl7Q==/lib/arm64, /data/app/mobile.betblocker-2q0r6WOyKpqIgRDwtWOl7Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)