2016-06-07 42 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文件中清理了我的编译。 –