title: Appium java-client java.lang.NoClassDefFoundError: Failed resolution of: Lio/appium/java_client/android/AndroidDriver;
body: <p><strong>Run androidTest with appium java-client on Android Emulator Test failed as below errors:</strong>
  <strong>I don't know how to fix, please help me, thanks!</strong></p>
  <pre>
  
      java.lang.NoClassDefFoundError: Failed resolution of: Lio/appium/java_client/android/AndroidDriver;
      at java.lang.Class.getDeclaredFields(Native Method)
      at org.junit.runners.model.TestClass.getSortedDeclaredFields(TestClass.java:77)
      at org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:70)
      at org.junit.runners.model.TestClass.(TestClass.java:57)
      at org.junit.runners.ParentRunner.createTestClass(ParentRunner.java:88)
      at org.junit.runners.ParentRunner.(ParentRunner.java:83)
      at org.junit.runners.BlockJUnit4ClassRunner.(BlockJUnit4ClassRunner.java:65)
      at androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner.(AndroidJUnit4ClassRunner.java:43)
      at androidx.test.internal.runner.junit4.AndroidJUnit4Builder.runnerForClass(AndroidJUnit4Builder.java:65)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
      at androidx.test.internal.runner.AndroidRunnerBuilder.runnerForClass(AndroidRunnerBuilder.java:153)
      at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:73)
      at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104)
      at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:793)
      at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:547)
      at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:390)
      at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)
      Caused by: java.lang.ClassNotFoundException: Didn't find class "io.appium.java_client.android.AndroidDriver" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/com.example.myapplication.test-Z4QneSzH9hljWZ6oCCYzMw==/base.apk", zip file "/data/app/com.example.myapplication-LZo-ohg3r_r3B07VbxeQdA==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.myapplication.test-Z4QneSzH9hljWZ6oCCYzMw==/lib/x86, /data/app/com.example.myapplication-LZo-ohg3r_r3B07VbxeQdA==/lib/x86, /system/lib, /system/product/lib]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      ... 19 more
      Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.example.myapplication-LZo-ohg3r_r3B07VbxeQdA==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.example.myapplication-LZo-ohg3r_r3B07VbxeQdA==/base.apk': Bad encoded_value method type size 7
      at dalvik.system.DexFile.openDexFileNative(Native Method)
      at dalvik.system.DexFile.openDexFile(DexFile.java:365)
      at dalvik.system.DexFile.(DexFile.java:107)
      at dalvik.system.DexFile.(DexFile.java:80)
      at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
      at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
      at dalvik.system.DexPathList.(DexPathList.java:164)
      at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:126)
      at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:101)
      at dalvik.system.PathClassLoader.(PathClassLoader.java:74)
      at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
      at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
      at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
      at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
      at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:851)
      at android.app.LoadedApk.getClassLoader(LoadedApk.java:950)
      at android.app.LoadedApk.getResources(LoadedApk.java:1188)
      at android.app.ContextImpl.createAppContext(ContextImpl.java:2462)
      at android.app.ContextImpl.createAppContext(ContextImpl.java:2454)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6343)
      at android.app.ActivityThread.access$1300(ActivityThread.java:219)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
      at android.os.Handler.dispatchMessage(Handler.java:107)
      at android.os.Looper.loop(Looper.java:214)
      at android.app.ActivityThread.main(ActivityThread.java:7356)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
  
  </pre>
  <p><strong>My app build.gradle:</strong></p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 30
      buildToolsVersion &quot;30.0.0&quot;
  
      packagingOptions {
          exclude 'META-INF/spring.schemas'
          exclude 'META-INF/spring.handlers'
          exclude 'META-INF/versions/9'
          exclude 'META-INF/spring.tooling'
          exclude 'META-INF/DEPENDENCIES'
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/LICENSE.txt'
          exclude 'META-INF/license.txt'
          exclude 'META-INF/NOTICE'
          exclude 'META-INF/NOTICE.txt'
          exclude 'META-INF/notice.txt'
          exclude 'META-INF/ASL2.0'
          exclude(&quot;META-INF/*.kotlin_module&quot;)
      }
  
      defaultConfig {
          applicationId &quot;com.example.myapplication&quot;
          minSdkVersion 29
          targetSdkVersion 30
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
  
      implementation 'androidx.appcompat:appcompat:1.1.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
      implementation group: 'io.appium', name: 'java-client', version: '7.3.0'
      implementation group: 'androidx.multidex', name: 'multidex', version: '2.0.1'
  }
  </code></pre>