Cannot compile Android application with scope

When I add the realm.io library to my Android application and try to run the application, I get this error at compile time:

Error: execution completed for task ': compileDebugJava'. > java.lang.ClassCastException: com.sun.tools.javac.code.Symbol $ The Symbol class cannot be added to javax.lang.model.element.PackageElement

This is my build.gradle:

buildscript { repositories { mavenCentral() maven { url 'http://download.crashlytics.com/maven' } } dependencies { classpath 'com.android.tools.build:gradle:0.13.2' classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+' classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0' } } apply plugin: 'android' apply plugin: 'crashlytics' apply plugin: 'com.android.application' apply plugin: 'hugo' repositories { mavenCentral() jcenter() maven { url 'http://download.crashlytics.com/maven' } } android { compileSdkVersion 19 buildToolsVersion '19.1' defaultConfig { minSdkVersion 14 targetSdkVersion 19 } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } packagingOptions { exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' } dexOptions { jumboMode = true } /*sourceSets { main { manifest.srcFile 'src/main/AndroidManifest.xml' java.srcDirs = ['src/main/java', 'src-gen/main/java'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } }*/ } dependencies { compile project(':libraries:AndroidBootstrap') compile 'com.android.support:appcompat-v7:19.+' compile 'com.crashlytics.android:crashlytics:1.+' compile files('libs/naga-3_0.jar') compile files('libs/branch-1.1.1.jar') compile 'com.google.code.gson:gson:2.2.4' compile 'com.viewpagerindicator:library: 2.4.1@aar ' compile 'com.google.android.gms:play-services:5.0.89' compile 'de.greenrobot:eventbus:2.2.1' compile 'com.github.kevinsawicki:http-request:5.6' compile 'com.maxmind.geoip2:geoip2:0.9.0' compile 'com.squareup.retrofit:retrofit:1.4.1' compile 'com.squareup.picasso:picasso:2.3.4' compile 'de.hdodenhof:circleimageview:1.2.0' compile 'com.helpshift:android-aar:3.6.0' compile 'io.realm:realm-android:0.73.1' compile project(':facebook') repositories { maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } compile('com.segment.analytics.android:core: 2.4.1@aar ') { transitive = true } } 

When I remove the dependency and area code, the application compiles fine. I am running Android Studio 0.8.14

+5
source share
2 answers

The problem turned out to be that my area models were nested classes, not top-level classes. Change of this is fixed.

+3
source

You do not have the correct getters and setters for the fields in your model.

+2
source

Source: https://habr.com/ru/post/1207485/


All Articles