Karthik CP
Karthik CP

Reputation: 1200

Error in Importing mapbox api in android studio

I already created an android map which gives the location of a bus based n gps data sent from server.. Initially it only displays the place from server api and sending it to app and application only displays it..

Now I need to implement a native map where it update the marker based on locations app receives. I Found out mapbox api and tried to use it but on compiling it gives certain error.. Can anybody help me to clear that..

my gradle.build (app)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 22
    buildToolsVersion '24'

    defaultConfig {
        applicationId "com.juasoft.safebus"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.leo.simplearcloader:simplearcloader:1.0.+'
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile 'com.android.support:support-v4:22.1.1'
    compile 'com.android.support:recyclerview-v7:22.1.1'
    compile('com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE')
    compile 'com.github.amlcurran.showcaseview:library:5.4.3'
    compile 'com.github.gabrielemariotti.cards:library:1.9.1'
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
    compile 'com.github.clans:fab:1.6.4'

}
repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    // add the Mapbox SDK dependency below
    compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-beta.1@aar'){
        transitive=true
    }
}
apply plugin: 'com.google.gms.google-services'

ERROR:

****/app/build/intermediates/res/merged/debug/values-v23/values-v23.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

v23/values-v23.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Base.TextAppearance.AppCompat.Widget.ActionBar.Menu" parent="android:TextAppearance.Material.Widget.ActionBar.Menu"/>
    <style name="Base.TextAppearance.AppCompat.Widget.Button.Inverse" parent="android:TextAppearance.Material.Widget.Button.Inverse"/>
    <style name="Base.Theme.AppCompat" parent="Base.V23.Theme.AppCompat"/>
    <style name="Base.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light"/>
    <style name="Base.V23.Theme.AppCompat" parent="Base.V22.Theme.AppCompat">
        <!-- We can use the platform styles on API 23+ -->
        <item name="ratingBarStyleIndicator">?android:attr/ratingBarStyleIndicator</item>
        <item name="ratingBarStyleSmall">?android:attr/ratingBarStyleSmall</item>

        <!-- We can use the platform drawable on v23+ -->
        <item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>
        <!-- We can use the platform styles on v23+ -->
        <item name="actionMenuTextColor">?android:attr/actionMenuTextColor</item>
        <item name="actionMenuTextAppearance">?android:attr/actionMenuTextAppearance</item>

        <item name="controlBackground">@drawable/abc_control_background_material</item>
    </style>
    <style name="Base.V23.Theme.AppCompat.Light" parent="Base.V22.Theme.AppCompat.Light">
        <!-- We can use the platform styles on API 23+ -->
        <item name="ratingBarStyleIndicator">?android:attr/ratingBarStyleIndicator</item>
        <item name="ratingBarStyleSmall">?android:attr/ratingBarStyleSmall</item>

        <!-- We can use the platform drawable on v23+ -->
        <item name="actionBarItemBackground">?android:attr/actionBarItemBackground</item>
        <!-- We can use the platform styles on v23+ -->
        <item name="actionMenuTextColor">?android:attr/actionMenuTextColor</item>
        <item name="actionMenuTextAppearance">?android:attr/actionMenuTextAppearance</item>

        <item name="controlBackground">@drawable/abc_control_background_material</item>
    </style>
    <style name="Base.Widget.AppCompat.Button.Colored" parent="android:Widget.Material.Button.Colored"/>
    <style name="Base.Widget.AppCompat.RatingBar.Indicator" parent="android:Widget.Material.RatingBar.Indicator"/>
    <style name="Base.Widget.AppCompat.RatingBar.Small" parent="android:Widget.Material.RatingBar.Small"/>
    <style name="Base.Widget.AppCompat.Spinner.Underlined" parent="android:Widget.Material.Spinner.Underlined"/>
</resources>

Upvotes: 0

Views: 773

Answers (1)

cammace
cammace

Reputation: 3168

The issue is because your compile SDK version isn't matching the support library's major version. They need to both be either 24 or 22. This should resolve the error.

On a side note, although this issue has nothing to do with Mapbox, you can clean up your build.gradle by combining the two dependencies into one. It'd look like this:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.leo.simplearcloader:simplearcloader:1.0.+'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile('com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE')
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.github.gabrielemariotti.cards:library:1.9.1'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.github.clans:fab:1.6.4'
testCompile 'junit:junit:4.12'

// add the Mapbox SDK dependency below
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-beta.1@aar'){
    transitive=true
}
}

Upvotes: 1

Related Questions