我在 build.gradle 中添加了模块依赖项,显然 Android Studio 没有抱怨,没有编译错误。但是当我点击“运行”启动应用程序时,我得到了 java.lang.NoClassDefFoundError。
我正在使用 Android Studio 的 Gradle。
我试过: gradle clean + gradle assemble 并成功构建,但在启动时仍然失败。
我的 build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile files('libs/android-support-v4.jar')
compile group:'com.deebl', name:'deebl-client-core', version:'0.0.1-SNAPSHOT'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
例外:
07-07 14:03:23.833 790-790/com.deebl E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.deebl.client.core.be.Movie
at com.deebl.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)