1

当我构建我的项目时,它会导致,

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.example.development, PID: 9013
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:415)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljunit/framework/Assert;
        at org.xwalk.core.XWalkCoreWrapper.attachXWalkCore(XWalkCoreWrapper.java:157)
        at org.xwalk.core.XWalkLibraryLoader$ActivateTask.doInBackground(XWalkLibraryLoader.java:335)
        at org.xwalk.core.XWalkLibraryLoader$ActivateTask.doInBackground(XWalkLibraryLoader.java:317)
        at android.os.AsyncTask$3.call(AsyncTask.java:394)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "junit.framework.Assert" on path: DexPathList[[zip file "/data/app/~~NzgvPrxXBKSwjzM6-Y1dUA==/com.example.development-AYz5gzS3rdEOK6e3P-Lhjw==/base.apk"],nativeLibraryDirectories=[/data/app/~~NzgvPrxXBKSwjzM6-Y1dUA==/com.example.development-AYz5gzS3rdEOK6e3P-Lhjw==/lib/x86, /data/app/~~NzgvPrxXBKSwjzM6-Y1dUA==/com.example.development-AYz5gzS3rdEOK6e3P-Lhjw==/base.apk!/lib/x86, /system/lib, /system_ext/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at org.xwalk.core.XWalkCoreWrapper.attachXWalkCore(XWalkCoreWrapper.java:157) 
        at org.xwalk.core.XWalkLibraryLoader$ActivateTask.doInBackground(XWalkLibraryLoader.java:335) 
        at org.xwalk.core.XWalkLibraryLoader$ActivateTask.doInBackground(XWalkLibraryLoader.java:317) 
        at android.os.AsyncTask$3.call(AsyncTask.java:394) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 

我以为是因为junit.framework.Assert。所以,我补充说

    testImplementation 'com.android.support.test:runner:1.0.2'
    testImplementation 'junit:junit:1.0.0'
    testImplementation 'androidx.test:core:1.4.0'
    testImplementation 'org.mockito:mockito-core:3.5.13'

但它仍然会导致同样的问题。

我该如何解决这个问题?

4

0 回答 0