AppCompat 错误 onCreate()
AppCompat Error onCreate()
我刚刚将我的项目从 Eclipse 导入到 Android Studio v1.2.11,现在该项目不再出现以下错误,该错误使应用程序在 onCreate() 方法中崩溃:
java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11.
我已将我的应用程序更新到最新的 v7 库,即 22.1.1。下面是我的 gradle.build 依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.android.support:support-v4:19.1.0') {
force = true
}
compile('com.google.android.gms:play-services-base:7.3.0') {
force = true
}
compile 'com.google.android.gms:play-services-plus:7.3.0'
compile 'joda-time:joda-time:2.7'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile('com.facebook.android:facebook-android-sdk:3.22.0@aar') {
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'bolts'
}
compile 'com.google.guava:guava:18.0'
compile project(':PullToRefreshListView')
compile project(':CircularImageView')
compile project(':CountryPicker')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v13:22.1.1'
}
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
注意:我在我认为支持 ActionBar 的样式中使用 Theme.AppCompat.Light。我想要实现的是导航。抽屉,但应用程序不会通过 onCreate()。对此异常的任何帮助将不胜感激
对于遇到类似问题的任何人,我都能够解决这个问题并且认为我应该与其他人分享。该错误是由于我的配置造成的,因为我在项目中排除了 android.support。一旦我评论它,它就消失了。
确保您的 class 依赖项在您的应用程序特定 build.gradle 文件中,而不是您的全局 build.gradle 文件中。
我刚刚将我的项目从 Eclipse 导入到 Android Studio v1.2.11,现在该项目不再出现以下错误,该错误使应用程序在 onCreate() 方法中崩溃:
java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11.
我已将我的应用程序更新到最新的 v7 库,即 22.1.1。下面是我的 gradle.build 依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.android.support:support-v4:19.1.0') {
force = true
}
compile('com.google.android.gms:play-services-base:7.3.0') {
force = true
}
compile 'com.google.android.gms:play-services-plus:7.3.0'
compile 'joda-time:joda-time:2.7'
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile('com.facebook.android:facebook-android-sdk:3.22.0@aar') {
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'bolts'
}
compile 'com.google.guava:guava:18.0'
compile project(':PullToRefreshListView')
compile project(':CircularImageView')
compile project(':CountryPicker')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v13:22.1.1'
}
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
注意:我在我认为支持 ActionBar 的样式中使用 Theme.AppCompat.Light。我想要实现的是导航。抽屉,但应用程序不会通过 onCreate()。对此异常的任何帮助将不胜感激
对于遇到类似问题的任何人,我都能够解决这个问题并且认为我应该与其他人分享。该错误是由于我的配置造成的,因为我在项目中排除了 android.support。一旦我评论它,它就消失了。
确保您的 class 依赖项在您的应用程序特定 build.gradle 文件中,而不是您的全局 build.gradle 文件中。