When you write a lib,AndroidTest in JsBridge, WebView.loadUrl (xxx) does not load successfully.

problem description

when writing a lib,AndroidTest in JsBridge, WebView.loadUrl (xxx) does not load successfully (no error message, no onPageStarted and onPageFinished), but works fine in example project.

this is the test code:

@RunWith(AndroidJUnit4.class)
public class JWalletManagerTest {
private static final String TAG = "JWalletManagerTest";
JWalletManager mJWalletManager;
CallBackFunction callBack;

@Test
public void createWallet() {
    Looper.prepare();
    TestLooperManager testLooperManager = InstrumentationRegistry.getInstrumentation().acquireLooperManager(Looper.myLooper());
    mJWalletManager = JWalletManager.getInstance(InstrumentationRegistry.getTargetContext());
    Log.v(TAG, "ccc");
    callBack = new CallBackFunction() {
        @Override
        public void onCallBack(String data) {
             Log.v(TAG, data);
        }
     };
     mJWalletManager.createWallet("", callBack);
     testLooperManager.release();
}

where JWalletManager

public static JWalletManager getInstance(Context context) {
    mWebview = new BridgeWebView(context);
    mWebview.loadUrl(JINGTUM_JS);
    return instance;
}

not long after contact with android, testing this piece is really powerless. I hope you can give me some advice if you know anything. Address of
Library https://github.com/JCCDex/jcc...

Apr.09,2022
Menu