我在一个函数中有这个:
Location locFirstLocation = lastLocations.get(0);
LatLngBounds bounds = Utils.boundsForLocations(lastLocations);
LatLng middle = bounds.getCenter();
Utils.boundsForLocations看起来像这样:
public static LatLngBounds boundsForLocations(ArrayList<Location> locations) {
if (locations == null || locations.size() == 0) {
return null;
}
Integer counter = 0;
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
LatLngBounds bounds;
for (Location loc : locations) {
if (loc != null) {
counter++;
boundsBuilder.include(new LatLng(loc.getLatitude(), loc.getLongitude()));
}
}
if (counter > 0) {
bounds = boundsBuilder.build();
return bounds;
} else {
return null;
}
}
我遇到了这个问题:
Error:(1545, 39) error: cannot access zza
class file for com.google.android.gms.common.internal.safeparcel.zza not found
我猜这东西已被弃用?我是否需要使用不同的边界?
编辑: Gradle文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url 'https://jcenter.bintray.com/' }
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath "io.realm:realm-gradle-plugin:3.2.0"
classpath 'com.google.gms:google-services:3.1.0' // google-services plugin
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url 'https://jcenter.bintray.com/' }
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com'
}
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "nl.hgrams.passenger"
minSdkVersion 17
targetSdkVersion 23
versionCode 905
versionName '2.9'
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
ext.enableCrashlytics = true
ext.betaDistributionReleaseNotesFilePath = "/Users/gopublic/bamboo-home/xml-data/build-dir/131073/PAS-PAD-VRANDROID/changelog.txt"
ext.betaDistributionEmails = "alin.rosu@100grams.nl, pedro.amanhui@100grams.nl, 100gramstest@gmail.com"
ext.betaDistributionGroupAliases = "passenger-android-beta"
}
debug {
minifyEnabled false
shrinkResources false
ext.enableCrashlytics = true
ext.betaDistributionEmails = "alin.rosu@100grams.nl, pedro.amanhui@100grams.nl, 100gramstest@gmail.com"
ext.betaDistributionReleaseNotesFilePath = "/Users/gopublic/bamboo-home/xml-data/build-dir/131073/PAS-PAD-VRANDROID/changelog.txt"
ext.betaDistributionGroupAliases = "passenger-android-beta"
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.google.code.gson:gson:2+'
compile 'com.android.volley:volley:1+'
compile 'com.jakewharton:butterknife:4.0.+'
compile 'com.squareup.okhttp:okhttp:2.0.0+'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.tonicartos:stickygridheaders:1.0.1@jar'
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/okhttp-urlconnection-2.0.0.jar')
compile project(':libraries:facebook')
compile 'com.edmodo:cropper:1.0.1'
compile 'com.squareup.picasso:picasso:2.3.3'
compile 'com.makeramen:roundedimageview:1.3.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.instabug.library:instabug:2+'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.plattysoft.leonids:LeonidsLib:1.3.1'
compile 'io.smooch:core:latest.release'
compile 'io.smooch:ui:latest.release'
compile 'com.android.support:percent:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile "com.daimajia.swipelayout:library:1.2.0@aar"
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
compile 'io.branch.sdk.android:library:1.+'
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
compile 'me.grantland:autofittextview:0.2.+'
compile 'com.github.kaknazaveshtakipishi:PermissionEverywhere:1.0.2'
compile 'com.google.firebase:firebase-core:11.2.2'
compile 'com.google.firebase:firebase-storage:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'
compile 'com.google.firebase:firebase-messaging:11.2.2'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile(
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
)
compile 'devlight.io:navigationtabbar:1.2.5'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:transition:26.0.2'
compile 'me.grantland:autofittextview:0.2.+'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
我通过将播放服务版本从10.2.0更改为11.2.2(与firebase相同)来修复它:
compile 'com.google.android.gms:play-services-maps:11.2.2'
compile 'com.google.android.gms:play-services-location:11.2.2'
compile 'com.google.android.gms:play-services-gcm:11.2.2'
compile 'com.google.android.gms:play-services-analytics:11.2.2'
compile 'com.google.android.gms:play-services-auth:11.2.2'