2016-09-09 45 views
0

我已經創建了一個android地圖,它提供了從服務器發送的基於總線的n gps數據的位置。最初它只顯示服務器api的位置並僅將它發送給應用程序和應用程序顯示它..在android studio中導入mapbox api的錯誤

現在我需要實現一個本地地圖,它根據應用程序接收的位置更新標記。 我發現mapbox API,並試圖使用它,但在編譯它給某些錯誤..任何人都可以幫我清除..

我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:[email protected]'){ 
     transitive=true 
    } 
} 
apply plugin: 'com.google.gms.google-services' 

錯誤:

****/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 /值-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> 

回答

1

問題是因爲您的編譯SDK版本與支持庫的主要版本不匹配。他們需要這兩個是24或22.這應該解決錯誤。

在附註中,儘管此問題與Mapbox無關,但可以通過將兩個依賴關係合併爲一個來清理build.gradle。它看起來像這樣:

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:[email protected]'){ 
    transitive=true 
} 
}