2016-06-07 41 views
0

我想在我的Android應用程序中添加一個優步「請求」按鈕。在我的gradle這個build文件我已經添加了以下行:在Android的優步SDK

compile 'com.uber.sdk:rides-android:0.5.0' 

自動的Android工作室詢問,因爲他們已經改變了同步的文件的gradle。之後,我得到了500多個錯誤與我的項目,但是當我刪除依賴關係,這一切都恢復正常。

任何人都可以請幫我解決這個問題嗎?

模塊gradle這個腳本:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

android { 
    useLibrary 'org.apache.http.legacy' 
} 

defaultConfig { 
    applicationId "com.example.android.myuberapp" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/fonts'] } } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile files('libs/android-async-http-1.4.4.jar') 
    compile files('libs/volley.jar') 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.android.support:design:23.2.0' 
    compile 'com.google.android.gms:play-services:8.4.0' 
    compile 'com.github.sembozdemir:ViewPagerArrowIndicator:1.0.0' 
    compile 'com.google.maps.android:android-maps-utils:0.4+' 
    compile 'com.github.jakob-grabner:Circle-Progress-View:v1.2.9' 
    compile 'me.grantland:autofittextview:0.2.+' 
    compile 'com.squareup.picasso:picasso:2.5.2' 
    compile 'com.uber.sdk:rides-android:0.5.0' 
} 

全套的錯誤:

Error file is here

+0

發佈一些錯誤會有所幫助。 – nicobatu

+0

嘿,我從事這個SDK。你可以發佈你的Gradle腳本和錯誤,我會幫你調試嗎? – tsmith

+0

@tsmith我添加了錯誤和gradle文件。希望你能幫助。 –

回答

2

它看起來就像你過去64k的限制,並應使multidex

這些「錯誤」的大部分實際上是警告說,gradle似乎是在一起。檢查錯誤的最後幾行以獲取確切的消息。

在你的build.gradle

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.0" 

    defaultConfig { 
     ... 
     minSdkVersion 14 
     targetSdkVersion 21 
     ... 

     // Enabling multidex support. 
     multiDexEnabled true 
    } 
    ... 
} 

dependencies { 
    compile 'com.android.support:multidex:1.0.0' 
} 

而在你的清單:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.android.multidex.myapplication"> 
    <application 
     ... 
     android:name="android.support.multidex.MultiDexApplication"> 
     ... 
    </application> 
</manifest> 

另外:

由於尤伯杯SDK是沒有那麼大,另一個延遲multidex的建議是隻有你您實際需要的Play服務庫。

例如,而不是

'com.google.android.gms:play-services:8.4.0' 

你可以只使用雲端通訊(如果是使用的組件)。

com.google.android.gms:play-services-gcm:8.4.0 

See more here

+0

謝謝!這對我有效。我把你們結合起來了。我首先設置了MultiDex,然後在gradle文件中清理了我的編譯。 –