Skip to content

Caused by: java.lang.RuntimeException when using mapbox plugin places. #1167

Open

Description

@yeshmesh

A runtime exception error is been caused when im using the below dependency :

    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.12.0'

My mabbox dependencies are :

//Map Box
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.12.0'

My build.gradle file:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'


    def ENVIRONMENT_PRODUCTION = "\"ENVIRONMENT_PRODUCTION\""
    def ENVIRONMENT_TEST_BED = "\"ENVIRONMENT_TEST_BED\""
    def ENVIRONMENT_DA = "\"ENVIRONMENT_DA\""
    def ENVIRONMENT_LOCAL_GENY = "\"ENVIRONMENT_LOCAL_GENY\""
    def ENVIRONMENT_LOCAL_EMUL = "\"ENVIRONMENT_LOCAL_EMUL\""

    //Select Correct Build Environment  before building from above
    def BUILD_ENVIRONMENT = ENVIRONMENT_TEST_BED

    lintOptions {
        abortOnError false
    }

    signingConfigs {
        release {
            storeFile file("etc/keys/apptizer.keystore")
            storePassword "apptizer"
            keyAlias "apptizer"
            keyPassword "apptizer"
        }
        clover {
            storeFile file("etc/keys/apptizer.keystore")
            storePassword "apptizer"
            keyAlias "apptizer"
            keyPassword "apptizer"
            v2SigningEnabled false
        }
    }

    def buildType = "debug"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 176
        versionName "1.0.0.14.RELEASE"
        multiDexEnabled true
        signingConfig signingConfigs.release
        buildConfigField "String", "ENVIRONMENT", BUILD_ENVIRONMENT
        logger.warn('\n\nBUILD ENVIRONMENT SELECTED >>> ' + BUILD_ENVIRONMENT + "\n\n")

        applicationVariants.all { variant ->
            renameAPK(variant, defaultConfig, BUILD_ENVIRONMENT, buildType)
        }
    }

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

    flavorDimensions "main"

    productFlavors {
        poynt {
            applicationId "io.apptizer.pos"
            dimension "main"
        }
        standalone {
            applicationId "io.apptizer.merchant.standalone"
            dimension "main"
        }
        dtp_hnb {
            applicationId "io.apptizer.merchant.dtp.hnb"
            dimension "main"
        }
        clover {
            applicationId "io.apptizer.business.clover"
            minSdkVersion 17
            targetSdkVersion 25
            signingConfig signingConfigs.clover
            dimension "main"
        }
        aevi {
            applicationId "io.apptizer.merchant.aevi"
            minSdkVersion 22
            dimension "main"
        }
        verifone {
            applicationId "io.apptizer.merchant.verifone"
            minSdkVersion 22
            dimension "main"
        }
    }
    dataBinding {
        enabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    preBuild.dependsOn copyConfig(BUILD_ENVIRONMENT)

}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation fileTree(include: ['*.jar'], dir: 'libs/printer')
    implementation fileTree(include: ['*.aar'], dir: 'libs/single-date-and-time-picker')
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    //Swipeable list view
    implementation "com.daimajia.swipelayout:library:1.2.0@aar"
    //color picker
    implementation 'com.larswerkman:HoloColorPicker:1.5'
    //image loader
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    // Poynt Dependencies
//    poyntImplementation 'co.poynt.api:android-api-model:1.2.108@jar'
//    poyntImplementation 'co.poynt.android.sdk:poynt-sdk:1.2.27@aar'
    //QR Code Reader dependencies
    implementation 'com.google.zxing:core:3.2.1'
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
    //GCM dependencies
    implementation 'com.google.android.gms:play-services-analytics:11.0.4'

    implementation('com.github.jkwiecien:EasyImage:2.0.0') {
        transitive = false
    }
    dtp_hnbImplementation(name: 'mswipechippersdk', ext: 'aar')
    aeviImplementation(name: 'AeviApi-2.7.2', ext: 'aar')
    cloverImplementation 'com.clover.sdk:clover-android-sdk:219.5'
    verifoneImplementation(name: 'PaymentManager-1.9.0.352-release', ext: 'aar')
    verifoneImplementation(name: 'DeveloperSDK-release-2.3.18', ext: 'aar')
    //dropbox sdk
    implementation 'com.dropbox.core:dropbox-core-sdk:3.0.3'
    implementation 'com.squareup.okhttp3:okhttp:3.5.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    //Fullscreen webview
    implementation 'com.thefinestartist:finestwebview:1.2.7'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation 'com.github.gcacace:signature-pad:1.2.1'
    implementation 'org.apache.httpcomponents:httpmime:4.2.3'
    implementation "com.mikepenz:iconics-core:3.0.3@aar"
    implementation "com.mikepenz:iconics-views:3.0.3@aar"
    implementation 'com.mikepenz:ionicons-typeface:2.0.1.4@aar'
    implementation 'com.mikepenz:fontawesome-typeface:5.0.13.0@aar'

    //  compile 'com.squareup.okhttp3:logging-interceptor:3.9.1'

    def lifecycle_version = "1.1.1"

    // ViewModel and LiveData
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'

    //DateTime Picker : https://github.com/florent37/SingleDateAndTimePicker
//    implementation 'com.github.florent37:singledateandtimepicker:2.1.0'

    //Used to generate html bitmap for newer receipt versions
    implementation 'com.izettle:html2bitmap:1.9'
    implementation 'org.apache.velocity:velocity:1.7'
    //todo need to be removed and implemented in our own way had to added as a hotfix for round1 unreproducible crash
    implementation 'me.drakeet.support:toastcompat:1.1.0'

    //GCM dependencies
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.google.android.gms:play-services-analytics:16.0.8'

    //Firebase
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-database:17.0.0'

    //Streams
    implementation 'com.annimon:stream:1.2.1'

    // Rx Java
    implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'

    // Retrofit
//    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
//    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
//    implementation 'com.squareup.retrofit2:adapter-rxjava2:2+'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'

    implementation 'com.google.android.material:material:1.0.0'

//Map Box
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.12.0'

}

def renameAPK(variant, defaultConfig, environment, buildType) {
    variant.outputs.all { output ->
        def readableEnvironment = environment.replace("\"", "").replace("_", "-").toLowerCase()
        outputFileName = applicationName + "-v-" + defaultConfig.versionName + "-" + defaultConfig.versionCode + "-" + variant.productFlavors[0].name + "-" + buildType + "-" + readableEnvironment + ".apk"
    }
}

def copyConfig(environment) {

    return tasks.create("copyConfiguration", Copy) {
        logger.warn('Copy config for envi >>> ' + environment + "\n\n")
        def directoryToCopy
        switch (environment) {
            case "\"ENVIRONMENT_PRODUCTION\"":
                directoryToCopy = "env/production/"
                break;
            case "\"ENVIRONMENT_TEST_BED\"":
                directoryToCopy = "env/testbed/"
                break;
            default:
                directoryToCopy = "env/development/"
        }
        from directoryToCopy
        into '.'
    }
}

my root build.gradle :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
        }
        maven { url 'https://maven.fabric.io/public' }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.+'
        classpath "io.realm:realm-gradle-plugin:5.3.1"
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
        }
        flatDir{
            dirs "libs","libs/verifone_sdk","libs/printer"
        }
        repositories {
            maven { url 'https://maven.fabric.io/public' }
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://mapbox.bintray.com/mapbox' }
//        maven {
//            url 'https://nexus.poynt.com/content/repositories/releases'
//        }
    }
}

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

If someone could help with the issue, ill be grateful to u.

Activity

  1. Guardiola31337 commented on Dec 11, 2020

    @Guardiola31337
    Contributor

    Hey @yeshmesh thanks for reaching out. From the snippets you shared it seems you're not integrating the Navigation SDK. Going to go ahead and move this issue to https://github.com/mapbox/mapbox-plugins-android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions