- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个带有 Android 注释的应用程序,当我尝试运行它时,它给我一个 NoClassDefFoundError。
java.lang.NoClassDefFoundError: br.socialcondo.app.rest.services.UserService_
在注释日志中我可以看到生成了这个类:
Note: Generating class: br.socialcondo.app.rest.services.UserService_
我做错了什么?
编辑
分享build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
mavenCentral()
}
configurations {
apt
}
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 30
versionName "2.0.0"
multiDexEnabled true
}
signingConfigs {
release {
storeFile file("xxx")
storePassword "xxx"
keyAlias "xxx"
keyPassword "xxx"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
ext.betaDistributionGroupAliases = "devs"
minifyEnabled false
signingConfig signingConfigs.release
}
}
productFlavors {
production {
applicationId "br.socialcondo.app"
}
development {
applicationId "br.socialcondo.app"
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'br.socialcondo.app'
}
}
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile group: 'com.google.guava', name: 'guava', version: '11.0.2'
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
// compile 'com.google.android.gms:play-services:4.2.42'
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
//
apt 'org.androidannotations:androidannotations:3.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:facebook')
compile project(':libraries:caldroid')
compile 'org.codehaus.jackson:jackson-jaxrs:1.9.13'
compile 'org.androidannotations:androidannotations-api:3.2'
compile 'com.google.android.gms:play-services:6.1.+'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.android.support:gridlayout-v7:22.1.1'
compile 'de.greenrobot:greendao:1.3.7'
compile 'com.koushikdutta.urlimageviewhelper:urlimageviewhelper:1.0.4'
compile('com.crashlytics.sdk.android:crashlytics:2.2.4@aar') {
transitive = true
}
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.makeramen:roundedimageview:1.5.0'
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.kbeanie:image-chooser-library:1.4.02@aar'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.commonsware.cwac:endless:1.2.3'
compile 'com.malinskiy:superrecyclerview:1.1.0'
}
编辑 2
根build.gradle
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
最佳答案
问题出在
multiDexEnabled true
它仅在 Android 5 上受原生支持。所以我需要一个图书馆在旧版本中运行。我找到了解决方法。
关于java - 带有 AndroidAnnotations NoClassDefFoundError 的 Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30491300/
我正在尝试从 AndroidAnnotations 3.3.2 升级到版本 4.0.0,但在升级后让 ORMLite 工作时遇到问题。升级到 4.0.0 并构建项目后,我收到错误消息:“错误:找不到符
我想将我的应用程序的某些部分提取到库中,但 AndroidAnnotations 不允许我 ;-) 如果我有: App - uses AndroidAnnotations - uses
我在 Android Studio gradle 项目中使用 AndroidAnnotations。我目前在编译期间从 AA 得到错误输出: cannot find symbol class MyAc
我有一个扩展父 fragment (NavMenu) 的 fragment (NavMenuStats)。 这个父 fragment 重写 onCreateView 方法,如下所示: @Nullabl
我在我的应用程序中使用 AndroidAnnotations,当我尝试将额外内容放入 Intent 并启动一个使用 AndroidAnnotations 的 Activity 时,我总是会收到运行时错
我用这个expandable recycler view库和 Android 注释。并尝试使用@NonConfigurationInstance注释。在 ItemViewHolder 类构造函数中,我
我在库中有一个带注释的 Activity,它是同一库中 EventBus 事件的订阅者。它看起来像这样,大大简化了: @EActivity(resName = "activity_foo") publ
我正在使用 Android Annotations RestService 进行 API 调用。唯一的问题是我收到了一个 JSON,但我不知道如何查看该 JSON 字符串。有没有一种方法可以查看响应数
所以我想尝试新的 Android Studio 并导入我的 eclipse 项目(我生成了一个 gradle 构建文件)。效果不错。 似乎唯一不起作用的库是 AndroidAnnotations。我在
如何将自定义操作栏布局与 AndroidAnnotations 结合使用? 有效的代码: @EActivity(R.layout.activity_register_classes) public c
我正在使用 AndroidAnnotation 开发 Android 应用程序。 应用程序对我的远程 API 进行 REST 调用。所以我设置了 AA 和我的 REST 客户端。但我想编写通用代码来处
我正在尝试使用 AndroidAnnotations 的 RestClient,但是当我调用客户端中的方法之一时,出现以下错误: 04-10 10:07:23.624 7528-7528/eu.
我有一个用 @Rest 注释的类,我在另一个实例中使用它的方法,用 @RestService 注释。当我调用 Rest 客户端类的某些方法时,出现 NetworkOnMainThreadExcepti
我有一个 Android 应用程序,我想下载一个大文件。 REST API 实现是通过 AndroidAnnotations 实现的。我需要使用此 REST 客户端(由 AndroidAnnotati
我正在尝试使用 AndroidAnnotations 创建一个简单的学习项目,它将与 REST 调用一起使用。我已经按照这个教程 https://github.com/androidannotatio
我有一个继承自 ListActivity 并使用 AndroidAnnotations 的 Activity 。虽然 .onListItemClick 工作正常,但列表项的上下文菜单根本没有出现,甚至
当RoboGuice触发事件时,我的事件回调会在哪里执行,在哪个线程?例如,我有一个具有 do(@Observes OnUpdateUiEvent e) 的 Activity 。我还有一个触发新 On
好的。 我正在尝试创建一个可以通过使用 maven 且仅使用 maven 来完美构建的项目。 目前,只要在实际 Java 代码中没有引用,我就面临着正在生成类并且工作正常的问题。 意思是,如果我在 d
我正在阅读有关依赖注入(inject)的文章,发现了 2 个引起我注意的库,AndroidAnnotations 和 Dagger 2。我看到的是 AA 具有很多功能,包括 DI,但是大多数开发人员都
我在使用 AndroidAnnotations 构建 Activity 时遇到了一些麻烦。我有一个名为 TemplateActivity 的父 Activity : @EActivity(R.layo
我是一名优秀的程序员,十分优秀!