NoClassDefFoundError on Gson not working on Lollipop only - java

So, everything with my app was working totally fine until one day I tried to perform a test using my Lollipop 5.1 phone and it crashed when using the Retrofit and OkHttp libraries.
UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/gson/Gson;
The error log takes me to my Application class, to the initialization of the Gson object (the Gson class is totally there).
public static Gson getGson() { return gson; }
private void initGson() {
gson = new Gson();
}
Many answers suggest me to use Multidex. I've already tried enabling multidex, and there's no difference:
defaultConfig {
applicationId yourApplicationId
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled true
versionCode 74
versionName '3.0.1'
}
And on the Application class, inside the onCreate method:
MultiDex.install(getAppContext());
The app crashes exclusively on Android 5.0 and 5.1, it works fine on Kitkat, Marshmallow and Nougat.
EDIT I'll include the full build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.jakewharton.butterknife'
android {
signingConfigs {
------
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
applicationId yourApplicationId
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled true
versionCode 74
versionName '3.0.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
dataBinding {
enabled = true
}
productFlavors {
-----
}
}
dependencies {
//noinspection GradleCompatible
//noinspection UseOfBundledGooglePlayServices
//compile fileTree(dir: 'libs', include: ['*.jar'])
//compile files('libs/gson-2.2.4.jar')
compile files('libs/android-query.0.26.7.jar')
compile('com.code-troopers.betterpickers:library:2.5.4') {
exclude group: 'com.nineoldandroids', module: 'library'
}
compile('com.github.sd6352051:NiftyNotification:1.2') {
exclude group: 'com.nineoldandroids', module: 'library'
}
compile('com.hwangjr.rxbus:rxbus:1.0.3') {
exclude group: 'com.hwangjr.utils', module: 'timber'
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:animated-vector-drawable:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.mixpanel.android:mixpanel-android:5.1.4'
compile 'com.google.android.gms:play-services:11.4.2'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.facebook.android:facebook-android-sdk:4.11.0'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
compile 'com.github.orangegangsters:swipy:1.2.2#aar'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.jakewharton:butterknife:8.6.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.jjobes:slideDateTimePicker:1.0.2'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.github.ybq:Android-SpinKit:1.1.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.joanzapata.pdfview:android-pdfview:1.0.4#aar'
compile 'me.zhanghai.android.materialprogressbar:library:1.4.1'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'biz.kasual:materialnumberpicker:1.2.1'
compile 'com.github.iwgang:simplifyspan:1.1'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.afollestad:sectioned-recyclerview:0.2.3'
compile 'com.marshalchen.ultimaterecyclerview:library:0.7.2'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'io.conekta:conektasdk:2.1'
compile 'com.google.zxing:core:3.2.1'
compile 'net.hockeyapp.android:HockeySDK:4.0.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.basgeekball:awesome-validation:2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
}
apply plugin: 'com.google.gms.google-services'

I solved this by importing only the Google services libraries that I needed instead of the whole package, so instead of doing this:
compile 'com.google.android.gms:play-services:11.4.2'
I import each library separately. Apparently it was loading too many libraries at the same time and it caused some weird issues to pop up.

Related

Facebook sdk conflict, compatibility error ? - Duplicate value for resource 'attr/font' with config "

I am trying to use Facebook login API, but when I write the "implementation" in gradle file, I get an error:
Error:(252, 5) error: duplicate value for resource 'attr/font' with config ''.
Error:(252, 5) error: resource previously defined here.
When I click on "Jump to source", Android Studio brings me in a file "values.xml", a non-writable file, that looks like this:
// More stuff above, the following line is where the error brings me
<dimen name="abc_action_bar_content_inset_material">16dp</dimen>
<dimen name="abc_action_bar_content_inset_with_nav">72dp</dimen>
<dimen name="abc_action_bar_default_height_material">56dp</dimen>
<dimen name="abc_action_bar_default_padding_end_material">0dp</dimen>
<dimen name="abc_action_bar_default_padding_start_material">0dp</dimen>
// More stuff
Here is my 'app' build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.discodery.android.discoderyapp"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
buildTypes.each {
it.buildConfigField 'Integer', 'RESTAURANT_ID', '2'
}
}
/*
productFlavors {
dev {
}
prod {
}
}*/
dataBinding {
enabled = true
}
}
kapt {
generateStubs = true
}
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 "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
//Permissions
compile 'com.beust:klaxon:2.0.11'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.hwangjr.rxbus:rxbus:1.0.5'
compile 'org.parceler:parceler-api:1.1.6'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.dagger:dagger:2.7'
compile 'com.facebook.fresco:fresco:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.karumi:dexter:2.3.1'
testCompile 'junit:junit:4.12'
kapt 'com.android.databinding:compiler:2.3.0'
kapt 'org.parceler:parceler:1.1.6'
kapt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.android.gms:play-services-vision:11.6.0'
// Facebook SDK Core only (Analytics)
implementation 'com.facebook.android:facebook-core:4.+'
// Facebook Login only
implementation 'com.facebook.android:facebook-login:4.+'
// Facebook Share only
implementation 'com.facebook.android:facebook-share:4.+'
// Facebook Places only
implementation 'com.facebook.android:facebook-places:4.+'
// Facbeook Messenger only
implementation 'com.facebook.android:facebook-messenger:4.+'
// Facebook App Links only
implementation 'com.facebook.android:facebook-applinks:4.+'
// Facebook Android SDK (everything)
implementation 'com.facebook.android:facebook-android-sdk:4.+'
// Audience Network SDK. Only versions 4.6.0 and above are available
implementation 'com.facebook.android:audience-network-sdk:4.+'
// Account Kit
implementation 'com.facebook.android:account-kit-sdk:4.+'
}
repositories {
jcenter()
mavenCentral()
}
apply plugin: 'kotlin-android-extensions'
Does someone have an idea about which "implementation" or "compile" line it could be from?
Without the Facebook SDK implementation lines, the project does compile and works properly.
As the logs tell me "duplicate value", I think that Facebook SKDs create some values like strings, that have exactly the same id or name that an other SDK.
Does anyone have a solution for this?
EDIT
The question concern the compatibility errors with Facebook SDK.
Is there a way to see if a dependency is or is not compatible with another one?

Error Annotation Processors must be explicitly declared now

Suddenly i got an error in the execution of the app.
I know that this qustion was already asked here: Annotation processors must be explicitly declared now
However the solution don't answer the problem :(
this is my build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion '27.0.0'
aaptOptions {
cruncherEnabled = true
}
defaultConfig {
applicationId "com.freelance.crdzbird_dev.clarobadge"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.javiersantos:MaterialStyledDialogs:2.1'
annotationProcessor 'com.google.auto.value:auto-value:1.1'
compile 'ai.api:libai:1.4.8'
compile 'ai.api:sdk:2.0.7#aar'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'io.mattcarroll.hover:hover:0.9.8'
compile 'com.gjiazhe:MultiChoicesCircleButton:1.0'
compile "org.apache.logging.log4j:log4j-core:2.8"
compile 'com.sackcentury:shinebutton:0.1.9'
compile 'com.yalantis:contextmenu:1.0.7'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.2'
compile 'me.samthompson:bubble-actions:1.3.0'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.github.apl-devs:appintro:v4.2.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.google.firebase:firebase-messaging:10.2.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
Anyone knows how can this error be solved. I search in google without success.
This is the error that recieve
Error:Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- log4j-core-2.8.jar (org.apache.logging.log4j:log4j-core:2.8)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
That user's error said this annotation processor was missing auto-value-1.1.jar (com.google.auto.value:auto-value:1.1), and the answer was to add:
annotationProcessor 'com.google.auto.value:auto-value:1.1'
Your error says log4j-core-2.8.jar (org.apache.logging.log4j:log4j-core:2.8) so you thought the answer was to add this?
annotationProcessor 'com.google.auto.value:auto-value:1.1'
You've copied it verbatim! Of course it won't work! Change the annotation processor to the one you're actually using.
Cough cough cough annotationProcessor 'org.apache.logging.log4j:log4j-core:2.8'
Please Add this to your build.gradle
testImplementation('org.robolectric:robolectric:4.3.1') {
// https://github.com/robolectric/robolectric/issues/5245
exclude group: 'com.google.auto.service', module: 'auto-service'
}
Like this
After that clean Project and Build
Hope it Helps

Conflict with dependency 'junit:junit'. Resolved versions for app (3.8.2) and test app (4.12) differ

I'm having a issue compiling an old Android application. The build.gradle file was deleted by the old developper (I don't know the reason). I managed to rewrite it and found all the dependencies but Im having the below error with junit
Conflict with dependency 'junit:junit'. Resolved versions for app (3.8.2) and test app (4.12) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
My build.gradle file content is here :
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
mavenCentral()
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.blappsta.dakar7com.d7"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
// https://mvnrepository.com/artifact/de.greenrobot/greendao
compile 'de.greenrobot:greendao:1.3.0'
// https://mvnrepository.com/artifact/com.github.bumptech.glide/glide
compile 'com.github.bumptech.glide:glide:3.7.0'
testCompile 'junit:junit:4.12'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:recyclerview-v7:+'
compile 'com.samwolfand.oneprefs:one-prefs:1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:9'
compile 'com.facebook.android:facebook-android-sdk:4.+'
// Audience Network SDK. Only versions 4.6.0 and above are available
compile 'com.facebook.android:audience-network-sdk:4.+'
// Account Kit
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.facebook.fresco:fresco:1.3.0'
compile 'com.android.support:multidex:1.0.1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.github.stfalcon:frescoimageviewer:0.3.1'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
// https://mvnrepository.com/artifact/com.google.guava/guava
compile 'com.google.guava:guava:10.0.1'
compile 'org.greenrobot:eventbus:3.0.0'
// https://mvnrepository.com/artifact/org.jsoup/jsoup
compile 'org.jsoup:jsoup:1.10.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex:rxandroid:1.2.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.afollestad.material-dialogs:core:0.9.4.5'
compile 'com.github.Angtrim:Android-Five-Stars-Library:v3.1'
compile 'com.android.support:design:25.0.0'
compile 'com.github.crosswall:Android-Coverflow:release-v1.0.4'
compile 'com.github.devlight:infinitecycleviewpager:1.0.0'
compile 'com.github.silvestrpredko:dot-progress-bar:1.1'
// https://mvnrepository.com/artifact/com.github.chrisbanes.photoview/library
compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
//compile files('libs/facebook-android-sdk-4.4.0-sources.jar')
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
I have seen similar questions but no way to find the right answer. Please let me know if I'm missing something.
NB: My Android Studio version is 2.2.3

Getting duplicate entry error after adding branch.io to my android project

Everything was working fine, but after adding this to my android project error building apk started.Here is the error and dependency
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/crashlytics/android/answers/shim/R.class
compile('io.branch.sdk.android:library:2.6.0#aar') {
transitive = true;
exclude module: 'answers-shim'
}
tried excluding it also but error persists.
Here is my full gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://dl.bintray.com/hani-momanii/maven"}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 19
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"
resConfigs "en_US", "hi_IN"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.digits.sdk.android:digits:2.0.6#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
compile('io.fabric.sdk.android:fabric:1.3.10#aar') {
transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-annotations:25.3.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.+'
compile 'com.amazonaws:aws-android-sdk-lambda:2.2.+'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.google.firebase:firebase-storage:10.2.1'
compile 'com.google.firebase:firebase-appindexing:10.2.1'
compile 'com.github.clans:fab:1.6.4'
compile 'com.amazonaws:aws-android-sdk-cognito:2.3.9'
compile 'hani.momanii.supernova_emoji_library:supernova-emoji-library:0.0.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile('io.branch.sdk.android:library:2.6.0#aar') {
transitive = true;
exclude module: 'answers-shim'
}
}
apply plugin: 'com.google.gms.google-services'
If i add the exclude statement to branch and digits then while entering the app it crashes,if added exclude to crashlytics the error persists.But without adding branch everything works perfect no error during apk build too.
I was struggling with this all day today as well. What ended up fixing it for me was rolling back branch to 2.5.9. There obviously seems to be something wrong with the new 2.6.0 release.
Another note for branch I don't have the transitive aar include so it's just
compile ('io.branch.sdk.android:library:2.5.9') {
exclude module: 'answers-shim';
}
Fixed the the issue when removed transitive = true from the dependency
compile('io.branch.sdk.android:library:2.6.0#aar') {
exclude module: 'answers-shim'
}
For those who want to use the latest version of branch.io, you have to add the following lines in your proguard file.
-dontwarn com.crashlytics.android.answers.shim.**
-dontwarn com.google.firebase.appindexing.**
-dontwarn com.android.installreferrer.api.**
With this change exclude module: answers-shim is not required in the gradle file.

Android ORMs: Can't recognize method in annotations

In my Android app I'm trying to implement ORM for SQLite database for existing db. I've tried to implement activeandroid and DBFlow, but Android studio shows error that it can't recognize method. Here's how it shows when I try to use DBFlow ORM and similarly for activeandroid it doesn't recognize methods in annotations. The red in below screenshot is error. It says it can't recognize method databaseName and also constant PRIMARY_KEY doesn't exist.
Here's project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// 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
}
And here's app: build.gradle
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myapplication"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'org.immutables:gson:2.0.6'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.8'
compile 'com.airbnb:deeplinkdispatch:1.5.0'
apt 'com.airbnb:deeplinkdispatch-processor:1.5.0'
apt 'com.github.Raizlabs.DBFlow:dbflow-processor:3.0.0-beta1'
compile "com.github.Raizlabs.DBFlow:dbflow-core:3.0.0-beta1"
compile "com.github.Raizlabs.DBFlow:dbflow:3.0.0-beta1"
}

Categories