[androidbrasil-dev] GreenDo dando NoClassDefFoundError

Estou usando o GreenDao em um projeto, porém quando o Android Studio tenta instalar o app dá a seguinte mensagem:
java.lang.NoClassDefFoundError: br.com.gracamesenger.model.DaoMaster$DevOpenHelper

A classe que herda Application:
public class MyApplication extends Application {

private static MyApplication myApplication;
public static final boolean ENCRYPTED = true;
private DaoSession daoSession;

@Override
protected void attachBaseContext(Context context) {
super.attachBaseContext(context);
MultiDex.install(this);
}

@Override
public void onCreate() {
super.onCreate();
DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "graca_talk", null);
DaoMaster daoMaster = new DaoMaster(helper.getWritableDatabase());
daoSession = daoMaster.newSession();
}
}


Na Activity:
DaoSession daoSession = ((MyApplication) getApplicationContext()).getDaoSession();

O arquivo build.gradle da raiz do projeto:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'

classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()

maven {
url "https://jitpack.io"
}

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

O arquivo build.gradle do módulo:
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
/*
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.greenrobot:greendao-gradle-plugin:3.0.0'
}
}
*/

android {
compileSdkVersion 24
buildToolsVersion '25.0.2'

defaultConfig {
applicationId "br.com.gracamesenger"
minSdkVersion 14
targetSdkVersion 24
versionCode 4
versionName "1.0.6"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

multiDexEnabled true


jackOptions {
enabled true
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

debug {
debuggable true
}
}

lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize "4g"
}
sourceSets {
main.java.srcDirs += 'build/generated/source/greendao'
}
}

greendao {
schemaVersion 1000
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'

compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'

compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:preference-v14:25.0.1'
compile 'com.android.support:gridlayout-v7:25.0.1'
compile 'com.android.support:multidex:1.0.1'

compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'

//compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.github.Aspsine:MultiThreadDownload:920fd6f670'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'

compile 'org.greenrobot:greendao:3.2.0'
compile 'org.greenrobot:greendao-generator:3.2.0'

compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'


androidTestCompile 'com.android.support:support-annotations:25.0.1'
//androidTestCompile 'com.android.support:support-annotations:22.1.1'
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:3.3.2"
}

uploadArchives.enabled = false


--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário