2016-03-21 11 views
0

Google'ın resmi PlacesPicker örneğini deniyorum. İlk aktiviteyi çalıştırır ve işler, ancak "Bir Yer Seç" düğmesine tıkladığımda, geçici olarak bir sonraki etkinliğe gider, ancak haritayı çok kısa bir süre gösterdikten sonra ana etkinliğe geri döner.
Ben BirGoogle'ın resmi PlacesPicker örneğinden gelen hataları çözün

İLK SAYI

Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.zze.zzb 

Ben

benim tezahür etmek android.support.mulitdex.MultiDexApplication ekleyerek çözmek çalıştı budur çözemezse iki sorunları vardır log baktığında
<application 
     android:allowBackup="true" 
     android:label="@string/app_name" 
     android:icon="@mipmap/ic_launcher" 
     android:theme="@style/AppTheme" 
     android:name="android.support.multidex.MultiDexApplication"> 

Ben de build.gradle

bu katma Ayrıca diğer kabul edilen çözümler

ben de selectiely build.gradle

compile 'com.google.android.gms:play-services-measurement:8.4.0' 
compile 'com.google.android.gms:play-services-analytics:8.4.0' 
compile 'com.google.android.gms:play-services-gcm:8.4.0' 
compile 'com.google.android.gms:play-services-location:8.4.0' 
compile 'com.google.android.gms:play-services-plus:8.4.0' 

İKİNCİ SAYI

12934/com.example.google.playservices.placepicker E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin. 
03-21 11:29:02.583 12934-12934/com.example.google.playservices.placepicker E/GMPM: Scheduler not set. Not logging error/warn. 
03-21 11:29:02.653 12934-13065/com.example.google.playservices.placepicker E/GMPM: Uploading is not possible. App measurement disabled 
için sadece gerekli google oyun hizmetlerini eklendi böylece 65k sınırı hatası ile ilgili olabileceğini öne sürdü

Stackoverflow'ta önerilen pek çok çözümü denedim, ancak başarılı olamadım. this ve this ve this, denediğim kabul edilen yanıtlardan sadece birkaçıdır.

Api anahtarının, google geliştirici konsoluma kaydedilmekte olduğundan geçerli olduğundan eminim. Resmi bir örneğin kolayca derlenip test edilememesi gerçekten sinir bozucu. Bu sorunları birisiyle karşılaştı mı ve bunları nasıl düzelttiniz? Ayrıca, Android Rehber API'sinin daha iyi güncellenmiş bir çalışma örneğini biliyorsanız veya biliyorsanız, lütfen bunu gerçekten takdir edeceğim.

GÜNCELLEME 1: MY MANIFEST DOSYA

<?xml version="1.0" encoding="UTF-8"?><!-- 
Copyright 2013 The Android Open Source Project 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
--> 


    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.example.google.playservices.placepicker" 
     android:versionCode="1" 
     android:versionName="1.0"> 

     <uses-sdk 
      android:minSdkVersion="14" 
      android:targetSdkVersion="19" /> 

     <!-- PlacePicker requires the ACCESS_FINE_LOCATION permission and a geo API key. 
     See this page for more information on how to obtain an API key: 
     https://developers.google.com/places/documentation/android/start 
     --> 
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
     <uses-permission android:name="android.permission.INTERNET" /> 
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

     <!-- PlacePicker also requires OpenGL ES version 2 --> 
     <uses-feature 
      android:glEsVersion="0x00020000" 
      android:required="true" /> 

     <application 
      android:allowBackup="true" 
      android:label="@string/app_name" 
      android:icon="@mipmap/ic_launcher" 
      android:theme="@style/AppTheme" 
      android:name="android.support.multidex.MultiDexApplication" 
      > 

      <meta-data android:name="com.google.android.gms.version" 
         android:value="@integer/google_play_services_version" /> 




      <meta-data 
        android:name="com.google.android.geo.API_KEY" 
        android:value="AIza..xxx...key.from.google" /> 



      <activity 
       android:name=".MainActivity" 
       android:label="@string/app_name"> 
       <intent-filter> 
        <action android:name="android.intent.action.MAIN" /> 
        <category android:name="android.intent.category.LAUNCHER" /> 
       </intent-filter> 
      </activity> 
     </application> 


    </manifest> 
+0

uygulamanızın geliştirici konsolu kayıtlı olduğu için etkin olup olmadığını ?? –

+0

Evet api anahtarını kullandım ve API çağrılarını geliştirici konsolumdan izleyebilirim. – TwoThumbSticks

+0

api anahtarını manifest dosyasına eklediniz mi ?? –

cevap

0

Bu yanıtı eklemek, çünkü belki başka biri yararlı bulacaktır.

Yorumdaki adımları belirttiğiniz gibi.

[1]

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

da uygulama etiketinin içinde bu satırı ekleyin uygun kullanıcı izinleri ekleyin

<meta-data 
    android:name="com.google.android.geo.API_KEY" 
    android:value="@string/google_maps_key" /> 

[2] google doğru paket adı Kayıt geliştirici Konsolu. Bildirim adı, bildirim dosyasında tanımlandı. Örneğin!

package="com.example.xyz" 

[3] Çift onay yeri API doğru uygun proje

0

Aynı sorun da bana oluştu. Ve doğru google_maps_key dizesini strings.xml ve google_maps_api.xml dosyasında sağlayarak çözdüm.

+0

Sadece manifest dosyasına anahtarı ekledim. Ayrıca sadece bir yer anahtarı api değil bir harita anahtarı kullanılır. Res.values ​​klasörlerine baktım ve herhangi bir strings.xml göremedim. – TwoThumbSticks

+0

Ayrıca , Manifest dosyasında etiketinin içinde olmalıdır.

+0

içinde değil mi, bunun böyle olması gerektiği anlamına mı geliyor? TwoThumbSticks

İlgili konular