你好,我在使用Android Studio运行时遇到了这个错误,但只有在SDK版本小于等于19的设备上。所有内容编译正常,但在我的databaseHelper类中出现了此错误。
java.lang.NoClassDefFoundError:
这是我的应用程序 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.github.johnpersano:supertoasts:1.3.4@aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.navercorp.pulltorefresh:library:3.2.0@aar'
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.j256.ormlite:ormlite-core:4.48'
}
我的数据库助手类扩展了
OrmLiteSqliteOpenHelper
。在我的compileSdkVersion为19时,一切都运行良好。以下是我进行的更新:
- gradle:
classpath 'com.android.tools.build:gradle:1.1.0'
> 1.3.0 - sdk版本:
compileSdkVersion 19
> 23 - appcompat:
com.android.support:appcompat-v7:19.0.1
> 23 - play-services