gpt4 book ai didi

java - 带有 AndroidAnnotations NoClassDefFoundError 的 Android Studio

转载 作者:行者123 更新时间:2023-11-29 05:05:35 24 4
gpt4 key购买 nike

我有一个带有 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com