Search code examples
android-gradle-pluginandroid-volleyretrofitokhttpevent-bus

Getting errors while integrating VISA checkout


I am integrating VISA checkout payment using the following link: Visa Checkout Integration in Android Studio.

My project is quite heavy. I had imported it from Eclipse which already contained many libraries. While integrating the VISA checkout, I added the the following in the gradle file, and its associated libraries:

compile(name:'VisaCheckout-Android-SDK-4.3', ext:'aar')

When I executed this code without any previous libraries, I didn't get any errors.

However when I run the code in my existing app in Lollipop, I get a blank screen which does not respond even on clicking the hardware back button.

I'm getting some unusual errors such as:

  1. No subscribers registered for event class com.visa.internal.ˌ

  2. No subscribers registered for event class de.greenrobot.event.NoSubscriberEvent

  3. Rejecting re-init on previously-failed class java.lang.Class

In Kitkat, the app crashes showing java.lang.NoClassDefFoundError: com.google.android.gms.analytics.GoogleAnalytics, (since Google Analytics is integrated in my project).

Here's my gradle file:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.fitcompany.fitness_enthusiasts"
        minSdkVersion 11
        targetSdkVersion 20
    }

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

repositories {
    flatDir { dirs 'libs'}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile project(':slidingMenu')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.android.gms:play-services:4.0.30'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.paypal.sdk:paypal-android-sdk:2.14.2'
    compile(name:'VisaCheckout-Android-SDK-4.3', ext:'aar')
    compile files('libs/volley.jar')
    compile files('libs/gson-2.3.1.jar')
    compile files('libs/HockeySDK-3.5.0.jar')
    compile files('libs/httpclient-android-4.3.3.jar')
    compile files('libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar')
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
        transitive = true;
    }
}

My libs folder contains the following:

  • eventbus-2.4.0.jar
  • gson-2.3.1.jar
  • HockeySDK-3.5.0.jar
  • ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar
  • libGoogleAnalyticsServices.jar
  • okhttp-2.5.0.jar
  • retrofit-1.9.0.jar
  • volley.jar
  • YouTubeAndroidPlayerApi.jar
  • VisaCheckout-Android-SDK-4.3.aar

Solution

  • I was using the wrong file in the libs folder. I replaced this line:

    VisaCheckout-Android-SDK-4.3.aar
    

    with this one and the error was gone.

    VisaCheckout-Android-SDK-2.9.aar