Android中的Uber SDK

时间:2016-06-07 20:42:54

标签: android sdk uber-api

我正在尝试添加一个Uber'请求乘车'我的Android应用程序中的按钮。在我的gradle构建文件中,我添加了以下行:

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

1 个答案:

答案 0 :(得分: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>

<强>单独:

由于Uber 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