I need to get some statistics about a certain youtube channel searched by user, and YouTube Data API doesn't provide me enough data. So how can I use YouTube Analytics API to get more data abou an youtube channel? I can't use their lib:
compile 'com.google.apis:google-api-services-youtubeAnalytics:v1-rev73-1.22.0'
because it gives me error, and I don't want to enable multidex:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
all my dependences are:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.+'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile "com.google.android.gms:play-services-gcm:10.0.1"
compile ('com.google.apis:google-api-services-youtubeAnalytics:v1-rev73-1.22.0'){
exclude module: 'httpclient' //by artifact name
exclude group: 'org.apache.httpcomponents' //by group
exclude group: 'org.apache.httpcomponents', module: 'httpclient' //by both name and group
}}
Check this documentation for the different types of reports you can retrieve using the API. Most of the workarounds I have read is to add
multiDexEnabled true
to your appbuild.gradle
file.Since you don't want to enable it, I can suggest to remove unused code with ProGuard. You should enable code shrinking to run ProGuard for your release builds. Enabling shrinking ensures you are not shipping unused code with your APKs.
You can refer with this another SO answer on how to get both statistics and snippet printed to the console with single api call.