简体   繁体   中英

Android Studio can't find class during runtime

I have a strange problem where i have included a class in my project, everything builds, but when it runs it crashes saying it cant find the class.

Im using the SlidingUpPanelLayout

https://github.com/umano/AndroidSlidingUpPanel

Here is the crash:

            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
         at dalvik.system.NativeStart.main(Native Method) 
      Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sothree.slidinguppanel.SlidingUpPanelLayout" on path: DexPathList[[zip file "/data/app/com.example.ns.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.ns.app-1, /vendor/lib, /system/lib]]
         at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
         at android.view.LayoutInflater.createView(LayoutInflater.java:559)
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:469) 
         at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
         at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
         at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
         at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
         at com.example.ns.app.MainActivity.onCreate(MainActivity.java:92) 
         at android.app.Activity.performCreate(Activity.java:5133) 
         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2227) 

Here is the gradle:

  apply plugin: 'com.android.application'

  android {
  compileSdkVersion 24
  buildToolsVersion "23.0.3"
  dexOptions {
      javaMaxHeapSize "8g"
  }
  defaultConfig {
      applicationId "com.example.ns.app"
      minSdkVersion 16
      targetSdkVersion 24
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
  }
  buildTypes {
      release {
    minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
  }

  packagingOptions {
      exclude 'META-INF/maven/commons-io/commons-io/pom.xml'
      exclude 'META-INF/maven/commons-io/commons-io/pom.properties'
  }
  configurations.all {
      resolutionStrategy.dependencySubstitution {
          substitute module('org.apache.commons:commons-io:1.3.2') with       module('commons-io:commons-io:1.3.2')
      }
      }
  }



  dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',       {
exclude group: 'com.android.support', module: 'support-annotations'
  })
  compile 'com.android.support:appcompat-v7:24.2.1'
  compile 'com.android.support:design:24.2.1'
  compile 'com.android.support:support-v4:24.2.1'
  testCompile 'junit:junit:4.12'
  compile 'com.github.amigold.fundapter:library:1.0'
  compile 'org.osmdroid:osmdroid-android:5.6.4'
  compile 'com.google.android.gms:play-services-location:9.6.1'
  compile 'com.sothree.slidinguppanel:library:3.3.1'
  compile 'org.apache.commons:commons-io:1.3.2'
  compile 'com.google.android.gms:play-services:11.0.2'
  }
defaultConfig {
        applicationId "com.ignite.a01hw909350.kolamdemo"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
        }
    }

Add the abiFilters in your build.gradle app module. Sync and clean your project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM