I want to use Google Maps in my android app, but I get this error every time I run the app and no map is showing
E/Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I have tried every solution on the internet,
I changed the API_Key, uninstalled the app before I run, Added all possible tags to manifest, yet google maps not showing.
When I downloaded a sample from the internet and got it run, but when try to add activity into my original app I get same error with no maps showing.
I have attached code in the manifest, build.gradle, and the map activity.
I also attached the Logcat and pic of the phone
I hope someone can put me on the right direction
Thanks
//Logcat
03-25 12:18:33.569 1877-1877/com.comp.roadmap.dev I/art﹕ Not late-enabling -Xcheck:jni (already on)
03-25 12:18:33.917 1877-1889/com.comp.roadmap.dev I/art﹕ Background sticky concurrent mark sweep GC freed 1760(106KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 729KB/729KB, paused 2.270ms total 114.494ms
03-25 12:18:34.323 1877-1896/com.comp.roadmap.dev D/OpenGLRenderer﹕ Render dirty regions requested: true
03-25 12:18:34.325 1877-1877/com.comp.roadmap.dev D/﹕ HostConnection::get() New Host Connection established 0xa6d9fa00, tid 1877
03-25 12:18:34.332 1877-1877/com.comp.roadmap.dev D/Atlas﹕ Validating map...
03-25 12:18:34.423 1877-1897/com.comp.roadmap.dev D/Exception﹕ java.net.UnknownHostException: Unable to resolve host "webservice.pollsdb.com": No address associated with hostname
--------- beginning of crash
03-25 12:18:34.423 1877-1897/com.comp.roadmap.dev E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
Process: com.comp.roadmap.dev, PID: 1877
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at java.io.StringReader.<init>(StringReader.java:47)
at com.comp.roadmap.app.login$CheckLoginWSTask.doInBackground(login.java:330)
at com.comp.roadmap.app.login$CheckLoginWSTask.doInBackground(login.java:295)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
03-25 12:18:34.428 1877-1896/com.comp.roadmap.dev D/﹕ HostConnection::get() New Host Connection established 0xa6d9fd80, tid 1896
03-25 12:18:34.454 1877-1896/com.comp.roadmap.dev I/OpenGLRenderer﹕ Initialized EGL, version 1.4
03-25 12:18:34.482 1877-1896/com.comp.roadmap.dev D/OpenGLRenderer﹕ Enabling debug mode 0
03-25 12:18:34.502 1877-1896/com.comp.roadmap.dev W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-25 12:18:34.502 1877-1896/com.comp.roadmap.dev W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa6db56e0, error=EGL_SUCCESS
03-25 12:18:34.573 1877-1896/com.comp.roadmap.dev W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-25 12:18:34.573 1877-1896/com.comp.roadmap.dev W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa6db5700, error=EGL_SUCCESS
03-25 12:18:34.734 1877-1889/com.comp.roadmap.dev I/art﹕ Background sticky concurrent mark sweep GC freed 961(70KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 1521KB/1704KB, paused 726us total 123.706ms
03-25 12:18:34.932 1877-1889/com.comp.roadmap.dev I/art﹕ Background partial concurrent mark sweep GC freed 692(36KB) AllocSpace objects, 0(0B) LOS objects, 25% free, 1492KB/2004KB, paused 1.413ms total 112.221ms
03-25 12:18:35.308 1877-1877/com.comp.roadmap.dev I/Choreographer﹕ Skipped 41 frames! The application may be doing too much work on its main thread.
03-25 12:18:35.815 1877-1877/com.comp.roadmap.dev E/WindowManager﹕ android.view.WindowLeaked: Activity com.comp.roadmap.app.login has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{1f1f0dc6 V.E..... R......D 0,0-684,322} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:261)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:298)
at com.comp.roadmap.app.login$CheckLoginWSTask.onPreExecute(login.java:447)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
at android.os.AsyncTask.execute(AsyncTask.java:535)
at com.comp.roadmap.app.login.LogMeIn(login.java:282)
at com.comp.roadmap.app.login.onCreate(login.java:145)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-25 12:18:47.249 1877-1897/com.comp.roadmap.dev I/Process﹕ Sending signal. PID: 1877 SIG: 9
03-25 12:18:59.919 2114-2126/com.comp.roadmap.dev I/art﹕ Background sticky concurrent mark sweep GC freed 2967(141KB) AllocSpace objects, 2(32KB) LOS objects, 0% free, 1254KB/1254KB, paused 1.542ms total 158.227ms
03-25 12:19:00.023 2114-2130/com.comp.roadmap.dev D/OpenGLRenderer﹕ Render dirty regions requested: true
03-25 12:19:00.028 2114-2114/com.comp.roadmap.dev D/﹕ HostConnection::get() New Host Connection established 0xa60ed060, tid 2114
03-25 12:19:00.046 2114-2114/com.comp.roadmap.dev D/Atlas﹕ Validating map...
03-25 12:19:00.142 2114-2130/com.comp.roadmap.dev D/﹕ HostConnection::get() New Host Connection established 0xa60a4a60, tid 2130
03-25 12:19:00.160 2114-2130/com.comp.roadmap.dev I/OpenGLRenderer﹕ Initialized EGL, version 1.4
03-25 12:19:00.198 2114-2130/com.comp.roadmap.dev D/OpenGLRenderer﹕ Enabling debug mode 0
03-25 12:19:00.238 2114-2130/com.comp.roadmap.dev W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-25 12:19:00.238 2114-2130/com.comp.roadmap.dev W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa60c5200, error=EGL_SUCCESS
03-25 12:19:00.313 2114-2130/com.comp.roadmap.dev W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-25 12:19:00.313 2114-2130/com.comp.roadmap.dev W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa60c5220, error=EGL_SUCCESS
03-25 12:19:00.653 2114-2114/com.comp.roadmap.dev I/Choreographer﹕ Skipped 34 frames! The application may be doing too much work on its main thread.
03-25 12:19:00.732 2114-2126/com.comp.roadmap.dev I/art﹕ Background sticky concurrent mark sweep GC freed 3217(193KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 1609KB/1801KB, paused 12.515ms total 36.928ms
03-25 12:19:01.149 2114-2130/com.comp.roadmap.dev W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-25 12:19:01.149 2114-2130/com.comp.roadmap.dev W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa60c5200, error=EGL_SUCCESS
03-25 12:19:01.339 2114-2114/com.comp.roadmap.dev I/zzx﹕ Making Creator dynamically
03-25 12:19:01.372 2114-2114/com.comp.roadmap.dev W/ResourcesManager﹕ Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
03-25 12:19:01.372 2114-2114/com.comp.roadmap.dev W/ResourcesManager﹕ Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
03-25 12:19:01.448 2114-2114/com.comp.roadmap.dev I/Google Maps Android API﹕ Google Play services client version: 7095000
03-25 12:19:01.499 2114-2126/com.comp.roadmap.dev W/art﹕ Suspending all threads took: 48.763ms
03-25 12:19:01.549 2114-2126/com.comp.roadmap.dev I/art﹕ Background sticky concurrent mark sweep GC freed 126(7KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 2MB/2MB, paused 86.924ms total 168.922ms
03-25 12:19:01.587 2114-2114/com.comp.roadmap.dev I/Google Maps Android API﹕ Google Play services package version: 7097470
03-25 12:19:02.333 2114-2126/com.comp.roadmap.dev I/art﹕ Background sticky concurrent mark sweep GC freed 10597(597KB) AllocSpace objects, 1(16KB) LOS objects, 4% free, 11MB/12MB, paused 3.255ms total 206.012ms
03-25 12:19:02.476 2114-2126/com.comp.roadmap.dev I/art﹕ Background partial concurrent mark sweep GC freed 14992(666KB) AllocSpace objects, 2(1015KB) LOS objects, 15% free, 10MB/12MB, paused 2.601ms total 128.036ms
03-25 12:19:02.605 2114-2138/com.comp.roadmap.dev E/Google Maps Android API﹕ Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
03-25 12:19:02.664 2114-2138/com.comp.roadmap.dev E/Google Maps Android API﹕ In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaSyDe8mb_u5CJ7D55Z2sohIoy9iT6SP_WM2A
Android Application (<cert_fingerprint>;<package_name>): A9:DC:CA:C8:90:F6:FA:44:1C:8F:5A:BC:EB:71:57:E8:6C:E5:3B:37;com.comp.roadmap.dev
03-25 12:19:02.667 2114-2138/com.comp.roadmap.dev I/Google Maps Android API﹕ Failed to contact Google servers. Another attempt will be made when connectivity is established.
03-25 12:19:02.792 2114-2130/com.comp.roadmap.dev W/EGL_emulation﹕ eglSurfaceAttrib not implemented
03-25 12:19:02.793 2114-2130/com.comp.roadmap.dev W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa4e7cf00, error=EGL_SUCCESS
03-25 12:19:04.727 2114-2149/com.comp.roadmap.dev D/﹕ HostConnection::get() New Host Connection established 0x9f4e91f0, tid 2149
03-25 12:19:04.758 2114-2114/com.comp.roadmap.dev I/Choreographer﹕ Skipped 122 frames! The application may be doing too much work on its main thread.
03-25 12:19:05.279 2114-2114/com.comp.roadmap.dev E/WindowManager﹕ android.view.WindowLeaked: Activity com.comp.roadmap.app.login has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{f60576c V.E..... R....... 0,0-684,388} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:261)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:298)
at android.app.AlertDialog$Builder.show(AlertDialog.java:987)
at com.comp.roadmap.app.login.Alert(login.java:271)
at com.comp.roadmap.app.login.access$300(login.java:36)
at com.comp.roadmap.app.login$CheckLoginWSTask.onPostExecute(login.java:378)
at com.comp.roadmap.app.login$CheckLoginWSTask.onPostExecute(login.java:295)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-25 12:19:17.719 2114-2150/com.comp.roadmap.dev E/Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
//Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.comp.roadmap.app" >
<permission android:name="com.comp.roadmap.app.permission.MAPS_RECEIVE"
android:protectionLevel="signature">
</permission>
<uses-permission android:name="com.comp.roadmap.app.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"></uses-feature>
<application
android:name=".PubVar"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".add_msg"
android:label="#string/title_activity_add_msg" >
</activity>
<activity
android:name=".ItemDetail"
android:label="#string/title_activity_item_detail" >
</activity>
<activity
android:name=".ListFilter"
android:label="#string/title_activity_list_filter" >
</activity>
<activity
android:name=".login"
android:label="#string/title_activity_login" >
<intent-filter android:label="#string/app_name" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".test1"
android:label="#string/title_activity_test1" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDe8mb_u5CJ7D55Z2sohIoy9iT6SP_WM2A" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps" >
</activity>
</application>
</manifest>
// build.gradle
apply plugin: 'android'
android {
compileSdkVersion 22
buildToolsVersion '21.1.2'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 7
versionName "0.1.65"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
dev {
applicationId "com.roadmap.schlogger.dev"
}
prod {
applicationId "com.roadmapb.schlogger.app"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/ftp4j-1.7.2.jar')
compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
}
//MapsActivity.java
package com.comp.roadmap.app;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity {
private GoogleMap mMap; // Might be null if Google Play services APK is not available.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
setUpMapIfNeeded();
}
#Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
/**
* Sets up the map if it is possible to do so (i.e., the Google Play services APK is correctly
* installed) and the map has not already been instantiated.. This will ensure that we only ever
* call {#link #setUpMap()} once when {#link #mMap} is not null.
* <p/>
* If it isn't installed {#link SupportMapFragment} (and
* {#link com.google.android.gms.maps.MapView MapView}) will show a prompt for the user to
* install/update the Google Play services APK on their device.
* <p/>
* A user can return to this FragmentActivity after following the prompt and correctly
* installing/updating/enabling the Google Play services. Since the FragmentActivity may not
* have been completely destroyed during this process (it is likely that it would only be
* stopped or paused), {#link #onCreate(Bundle)} may not be called again so we should call this
* method in {#link #onResume()} to guarantee that it will be called.
*/
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}
/**
* This is where we can add markers or lines, add listeners or move the camera. In this case, we
* just add a marker near Africa.
* <p/>
* This should only be called once and when we are sure that {#link #mMap} is not null.
*/
private void setUpMap() {
mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}
//activity_maps.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:id="#+id/map"
tools:context="com.comp.roadmap.app.MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment" />
If you are using emulator maybe you dont have Google Play Services installed, and even if you have google play services installed check if you have the latest version.
According your exception:
Caused by: java.lang.NullPointerException:
Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at java.io.StringReader.(StringReader.java:47)
at com.comp.roadmap.app.login$CheckLoginWSTask.doInBackground(login.java:330)
at com.comp.roadmap.app.login$CheckLoginWSTask.doInBackground(login.java:295)
In line doInBackground(login.java:295) you are asking for a lenght of a null String variable.
Also, which API are you using?
Ensure that the "Google Maps Android API v2" is enabled.
And:
Ensure that the following Android Key exists: API Key: AIzaSyDe8mb_u5CJ7D55Z2sohIoy9iT6SP_WM2A
You downloaded API and registered to be able to use maps api?
Related
I/art: Background sticky concurrent mark sweep GC freed 2534(750KB) AllocSpace objects, 2(32KB) LOS objects, 16% free, 1439KB/1723KB, paused 1.210ms total 209.320ms
W/art: Suspending all threads took: 48.938ms
W/MainActivity: onResume
W/art: Suspending all threads took: 33.435ms
I/art: Background partial concurrent mark sweep GC freed 1004(119KB) AllocSpace objects, 0(0B) LOS objects, 41% free, 1448KB/2MB, paused 33.859ms total 111.039ms
D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
[ 09-02 18:38:14.477 2286: 2286 D/ ]
HostConnection::get() New Host Connection established 0x7f5d1785eac0, tid 2286
D/Atlas: Validating map...
E/AndroidRuntime: FATAL EXCEPTION: IntentService[]
Process: com.example.user.gcmexample, PID: 2286
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
at com.google.android.gms.iid.zzd.zzdL(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at com.example.user.gcmexample.GCMRegistrationIntentService.registerGCM(GCMRegistrationIntentService.java:31)
at com.example.user.gcmexample.GCMRegistrationIntentService.onHandleIntent(GCMRegistrationIntentService.java:24)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Enabling debug mode 0
W/EGL_emulation: eglSurfaceAttrib not implemented
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f5d1a94d200, error=EGL_SUCCESS
W/MainActivity: onPause
I/Process: Sending signal. PID: 2286 SIG: 9
Application terminated.
I am working on google cloud messaging with Android. When I am running program, my app not launching and giving error message
Unfortunately "Application name " has stopped.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm using ProgressDialog to show a loading page in my android app .
My code looks like :
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setCancelable(false);
dialog.setMessage("please Wait ...");
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setProgressStyle(R.style.progress_dialog_style);
dialog.show();
String toastMsg = null;
LoginService loginService = new LoginService(LoginActivity.this);
ProfileDetails profileDetails = loginService.checkLogin(mobile_number.getText().toString().trim(), password.getText().toString().trim());
if(profileDetails != null && loginService.changeLogin(MainActivity.LOGIN_YES, mobile_number.getText().toString().trim())) {
toastMsg = MainActivity.LOGIN_SUCCESSFUL;
}
if(profileDetails == null) {
runOnUiThread(new Runnable() {
public void run() {
dialog.dismiss();
}
});
}
and then i perform some DB Operations and get some data
and i use dialog.dismiss().
If i get data successfully i use startActivity(intent);
Here
i) if i use dialog.dismiss() when i run the code i am not able to see the Dialog.
ii) When i remove the dialog.dimiss() section i am able to see the Dialog but unable to close it.
Please resolve this problem.
Thank You
Log i got is
12-16 00:12:42.325 2146-2172/mycompany.com.weekendmovierating W/EGL_emulation﹕ eglSurfaceAttrib not implemented
12-16 00:12:42.325 2146-2172/mycompany.com.weekendmovierating W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa34423e0, error=EGL_SUCCESS
12-16 00:12:42.632 2146-2172/mycompany.com.weekendmovierating W/EGL_emulation﹕ eglSurfaceAttrib not implemented
12-16 00:12:42.632 2146-2172/mycompany.com.weekendmovierating W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa34422e0, error=EGL_SUCCESS
12-16 00:12:42.804 2146-2160/mycompany.com.weekendmovierating I/art﹕ WaitForGcToComplete blocked for 58.235ms for cause Background
12-16 00:12:42.937 2146-2156/mycompany.com.weekendmovierating W/art﹕ Suspending all threads took: 38.186ms
12-16 00:12:42.938 2146-2160/mycompany.com.weekendmovierating W/art﹕ Suspending all threads took: 19.448ms
12-16 00:12:42.946 2146-2160/mycompany.com.weekendmovierating I/art﹕ Background sticky concurrent mark sweep GC freed 8670(494KB) AllocSpace objects, 5(100KB) LOS objects, 0% free, 5MB/5MB, paused 21.810ms total 130.763ms
12-16 00:12:43.105 2146-2160/mycompany.com.weekendmovierating W/art﹕ Suspending all threads took: 61.760ms
12-16 00:12:43.171 2146-2146/mycompany.com.weekendmovierating I/Choreographer﹕ Skipped 44 frames! The application may be doing too much work on its main thread.
12-16 00:12:43.245 2146-2160/mycompany.com.weekendmovierating I/art﹕ Background partial concurrent mark sweep GC freed 1796(126KB) AllocSpace objects, 2(76KB) LOS objects, 39% free, 5MB/9MB, paused 12.887ms total 76.159ms
12-16 00:12:43.803 2146-2172/mycompany.com.weekendmovierating W/EGL_emulation﹕ eglSurfaceAttrib not implemented
12-16 00:12:43.803 2146-2172/mycompany.com.weekendmovierating W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xb3fdece0, error=EGL_SUCCESS
12-16 00:12:44.892 1294-1313/system_process I/ActivityManager﹕ Displayed mycompany.com.weekendmovierating/mycompany.weekendmovierating.activity.SelectLanguageActivity: +2s541ms
12-16 00:12:45.023 2146-2146/mycompany.com.weekendmovierating I/Choreographer﹕ Skipped 69 frames! The application may be doing too much work on its main thread.
12-16 00:12:45.055 1545-6738/com.android.inputmethod.latin E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7d6dc0
12-16 00:12:45.082 2146-2172/mycompany.com.weekendmovierating E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7da1d0
12-16 00:12:45.093 2146-2172/mycompany.com.weekendmovierating E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7d8870
12-16 00:12:45.148 2146-2172/mycompany.com.weekendmovierating E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xab7d85d0
12-16 00:12:45.342 2146-2146/mycompany.com.weekendmovierating E/WindowManager﹕ android.view.WindowLeaked: Activity mycompany.weekendmovierating.activity.LoginActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{ffa0769 V.E...... R......D 0,0-760,192} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at mycompany.weekendmovierating.activity.LoginActivity.login(LoginActivity.java:87)
at java.lang.reflect.Method.invoke(Native Method)
at android.view.View$DeclaredOnClickListener.onClick(View.java:4447)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-16 00:12:45.371 2146-2156/mycompany.com.weekendmovierating W/art﹕ Suspending all threads took: 25.085ms
12-16 00:12:45.397 1294-1305/system_process W/WindowManager﹕ Failed looking up window
java.lang.IllegalArgumentException: Requested window android.os.BinderProxy#aa60cd1 does not exist
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8723)
at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8714)
at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2697)
at com.android.server.wm.Session.remove(Session.java:187)
at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:242)
at com.android.server.wm.Session.onTransact(Session.java:130)
at android.os.Binder.execTransact(Binder.java:453)
runOnUiThread(new Runnable() {
#Override
public void run()
{
progress.dismiss();
}
Dismiss your dialog like this in runnable thread.
I am facing a problem with one of my watch face "fr.thema.wear.watch.eyeonbattery".
When I install it on a wear device or on emulator, nothing goes wrong and it works fine.
Then I reboot the wear device or the emulator. It restarts on my watch face as expected, but some seconds after, the screens turns black, and it falls back on the default android watch face "simple".
In the logs, I am getting the following :
04-20 11:26:43.801 3013-3041/com.google.android.clockwork.packageinstaller W/WearablePkgInstaller﹕ Version number of new app (0) is equal to existing app for com.google.android.apps.maps
04-20 11:26:43.805 350-357/system_process W/art﹕ Suspending all threads took: 6.715ms
04-20 11:26:43.842 1919-2913/com.google.android.wearable.app D/WearablePackageInfoProvider﹕ 3013 is a system app.
04-20 11:26:43.952 3013-3041/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent installation request for com.google.android.apps.maps
04-20 11:26:43.990 1919-1945/com.google.android.wearable.app D/WearablePackageInfoProvider﹕ 3013 is a system app.
04-20 11:26:44.337 350-357/system_process W/art﹕ Suspending all threads took: 29.792ms
04-20 11:26:44.807 350-357/system_process W/art﹕ Suspending all threads took: 7.394ms
04-20 11:26:45.476 350-357/system_process W/art﹕ Suspending all threads took: 105.178ms
04-20 11:26:45.523 350-362/system_process W/art﹕ Suspending all threads took: 49.255ms
04-20 11:26:45.622 350-362/system_process I/art﹕ Background partial concurrent mark sweep GC freed 17258(692KB) AllocSpace objects, 11(1453KB) LOS objects, 19% free, 7MB/9MB, paused 52.684ms total 635.886ms
04-20 11:26:45.631 350-361/system_process I/art﹕ WaitForGcToComplete blocked for 572.338ms for cause HeapTrim
04-20 11:26:46.050 1949-1949/fr.thema.wear.watch.eyeonbattery I/Choreographer﹕ Skipped 36 frames! The application may be doing too much work on its main thread.
04-20 11:26:46.383 350-357/system_process W/art﹕ Suspending all threads took: 65.046ms
04-20 11:26:48.444 3013-3041/com.google.android.clockwork.packageinstaller W/WearablePkgInstaller﹕ Version number of new app (1401) is equal to existing app for com.google.android.music
04-20 11:26:48.548 1919-1948/com.google.android.wearable.app D/WearablePackageInfoProvider﹕ 3013 is a system app.
04-20 11:26:48.975 3013-3041/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent installation request for com.google.android.music
04-20 11:26:49.085 3013-3041/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent delete request for fr.thema.wear.watch.eyeonbattery
04-20 11:26:49.089 350-997/system_process I/PackageManager﹕ Package doesn't exist in get block uninstall fr.thema.wear.watch.glowingtron
04-20 11:26:49.090 3013-3041/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent delete request for fr.thema.wear.watch.glowingtron
04-20 11:26:49.124 1919-2447/com.google.android.wearable.app D/WearablePackageInfoProvider﹕ 3013 is a system app.
04-20 11:26:49.328 350-357/system_process W/art﹕ Suspending all threads took: 20.445ms
04-20 11:26:49.648 350-362/system_process I/art﹕ Background sticky concurrent mark sweep GC freed 26253(917KB) AllocSpace objects, 8(464KB) LOS objects, 14% free, 8MB/9MB, paused 2.719ms total 213.076ms
04-20 11:26:50.357 350-357/system_process W/art﹕ Suspending all threads took: 29.915ms
04-20 11:26:50.625 350-426/system_process D/PackageManager﹕ Renaming /data/app/vmdl250365332.tmp to /data/app/com.google.android.apps.fitness-1
04-20 11:26:50.659 350-426/system_process W/PackageManager﹕ New package has a different signature: com.google.android.apps.fitness
04-20 11:26:50.727 350-386/system_process I/ActivityManager﹕ Force stopping fr.thema.wear.watch.eyeonbattery appid=10038 user=-1: uninstall pkg
04-20 11:26:50.729 350-386/system_process I/ActivityManager﹕ Killing 1949:fr.thema.wear.watch.eyeonbattery/u0a38 (adj 1): stop fr.thema.wear.watch.eyeonbattery
04-20 11:26:50.759 350-2672/system_process I/WindowState﹕ WIN DEATH: Window{34900f38 u0 fr.thema.wear.watch.eyeonbattery.WatchFaceService}
04-20 11:26:50.781 350-350/system_process W/WallpaperManagerService﹕ Wallpaper service gone: ComponentInfo{fr.thema.wear.watch.eyeonbattery/fr.thema.wear.watch.eyeonbattery.WatchFaceService}
04-20 11:26:50.827 350-357/system_process W/art﹕ Suspending all threads took: 18.019ms
04-20 11:26:50.853 350-386/system_process W/ActivityManager﹕ Scheduling restart of crashed service fr.thema.wear.watch.eyeonbattery/.WatchFaceService in 1000ms
04-20 11:26:50.877 350-386/system_process I/ActivityManager﹕ Force stopping service ServiceRecord{2fb89f01 u0 fr.thema.wear.watch.eyeonbattery/.WatchFaceService}
04-20 11:26:50.951 350-2179/system_process W/ActivityManager﹕ Spurious death for ProcessRecord{2a3fc305 1949:fr.thema.wear.watch.eyeonbattery/u0a38}, curProc for 1949: null
04-20 11:26:51.024 350-405/system_process I/Choreographer﹕ Skipped 75 frames! The application may be doing too much work on its main thread.
04-20 11:26:51.148 350-405/system_process I/Choreographer﹕ Skipped 77 frames! The application may be doing too much work on its main thread.
04-20 11:26:51.218 350-405/system_process I/Choreographer﹕ Skipped 58 frames! The application may be doing too much work on its main thread.
04-20 11:26:51.278 350-405/system_process I/Choreographer﹕ Skipped 30 frames! The application may be doing too much work on its main thread.
04-20 11:26:51.376 350-405/system_process I/Choreographer﹕ Skipped 88 frames! The application may be doing too much work on its main thread.
04-20 11:26:51.455 350-405/system_process I/Choreographer﹕ Skipped 64 frames! The application may be doing too much work on its main thread.
04-20 11:26:51.827 350-357/system_process W/art﹕ Suspending all threads took: 15.446ms
04-20 11:26:52.035 350-426/system_process I/ActivityManager﹕ Force stopping fr.thema.wear.watch.eyeonbattery appid=10038 user=0: pkg removed
04-20 11:26:52.159 350-1049/system_process I/InputReader﹕ Reconfiguring input devices. changes=0x00000010
04-20 11:26:52.569 350-357/system_process W/art﹕ Suspending all threads took: 256.793ms
04-20 11:26:52.624 350-350/system_process D/JobSchedulerService﹕ Receieved: android.intent.action.PACKAGE_REMOVED
04-20 11:26:52.659 1919-1919/com.google.android.wearable.app I/art﹕ Explicit concurrent mark sweep GC freed 8554(574KB) AllocSpace objects, 7(501KB) LOS objects, 24% free, 2MB/3MB, paused 1.676ms total 571.570ms
04-20 11:26:52.790 350-383/system_process W/Searchables﹕ No global search activity found
04-20 11:26:52.918 350-357/system_process W/art﹕ Suspending all threads took: 104.949ms
04-20 11:26:52.957 350-362/system_process I/art﹕ Background partial concurrent mark sweep GC freed 49001(2MB) AllocSpace objects, 7(338KB) LOS objects, 19% free, 6MB/8MB, paused 17.728ms total 706.074ms
04-20 11:26:53.187 2099-2819/com.google.process.gapps I/art﹕ WaitForGcToComplete blocked for 6.850ms for cause DisableMovingGc
04-20 11:26:53.499 350-383/system_process W/WallpaperManagerService﹕ Wallpaper uninstalled, removing: ComponentInfo{fr.thema.wear.watch.eyeonbattery/fr.thema.wear.watch.eyeonbattery.WatchFaceService}
04-20 11:26:53.715 1919-1941/com.google.android.wearable.app I/art﹕ Background sticky concurrent mark sweep GC freed 2023(241KB) AllocSpace objects, 3(48KB) LOS objects, 6% free, 3MB/3MB, paused 2.063ms total 276.771ms
04-20 11:26:54.007 1919-1941/com.google.android.wearable.app I/art﹕ Background partial concurrent mark sweep GC freed 2065(191KB) AllocSpace objects, 0(0B) LOS objects, 24% free, 3MB/4MB, paused 1.844ms total 274.264ms
04-20 11:26:54.443 350-357/system_process W/art﹕ Suspending all threads took: 616.049ms
04-20 11:26:54.547 350-426/system_process W/art﹕ Suspending all threads took: 10.861ms
04-20 11:26:54.761 1919-1919/com.google.android.wearable.app W/ClockworkHome.HomeView﹕ Watch face removed
It seems that the watch face is uninstalled due to a conflict with android.music.
04-20 11:26:48.444 3013-3041/com.google.android.clockwork.packageinstaller W/WearablePkgInstaller﹕ Version number of new app (1401) is equal to existing app for com.google.android.music
04-20 11:26:48.548 1919-1948/com.google.android.wearable.app D/WearablePackageInfoProvider﹕ 3013 is a system app.
04-20 11:26:48.975 3013-3041/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent installation request for com.google.android.music
04-20 11:26:49.085 3013-3041/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent delete request for fr.thema.wear.watch.eyeonbattery
Am I right?
Is there a solution to this issue? I did not found out what was the problem in the first place :(
I found out that after installing the release apk on the phone, the embedded wear apk deployed on wear device was an older version (features missing, pretty weird).
By searching on internet, I found an other thread (in which you participated in) from a dev experiencing the same problem of older version deployed.
android-wear embedding old (cached) wear apk in the mobile-release apk
I followed your procedure, and it solved the problem of older version. And the problem of watch face uninstalled also.
I think that the wear device does these delete of watch face when this problem of version occurs.
So it seems to be an issue of the "Google Play Service". I hope it will not happen to often.
Thanks a lot Wayne Piekarski for your answer on this thread and the other one, It was very helpful
I've looked at just about every question on here regarding this error and still haven't been able to track it down.
Here's my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cs2110_final"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.example.cs2110_final.TheHunt.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.cs2110_final.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.cs2110_final.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>
<activity
android:name="com.example.cs2110_final.TheHunt"
android:label="#string/title_activity_the_hunt" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="(API key edited out)" />
</application>
</manifest>
Here's my Activity code:
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
And here's the XML reference to the Map:
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
I've gone through the entire API process three times now and no luck. Every permission that needs to be put in the manifest has been, as far as I can tell (even the sneaky GPS_Services one). Any ideas? Thanks in advance for any help!
Edit: here's the LogCat output. It's this, followed by many repetitions of "Failed to load map..."
04-19 13:59:03.108: D/dalvikvm(26070): GC_CONCURRENT freed 252K, 6% free 7534K/7940K, paused 4ms+7ms, total 29ms
04-19 13:59:03.138: D/libEGL(26070): loaded /system/lib/egl/libEGL_tegra.so
04-19 13:59:03.148: D/libEGL(26070): loaded /system/lib/egl/libGLESv1_CM_tegra.so
04-19 13:59:03.168: D/libEGL(26070): loaded /system/lib/egl/libGLESv2_tegra.so
04-19 13:59:03.198: D/OpenGLRenderer(26070): Enabling debug mode 0
04-19 13:59:05.968: D/dalvikvm(26070): GC_CONCURRENT freed 301K, 6% free 7654K/8108K, paused 3ms+3ms, total 21ms
04-19 13:59:06.048: D/dalvikvm(26070): GC_CONCURRENT freed 216K, 5% free 7877K/8248K, paused 3ms+2ms, total 29ms
04-19 13:59:06.128: D/dalvikvm(26070): GC_CONCURRENT freed 309K, 6% free 8079K/8540K, paused 3ms+3ms, total 26ms
04-19 13:59:06.128: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 5ms
04-19 13:59:06.128: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 5ms
04-19 13:59:06.128: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 6ms
04-19 13:59:06.128: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 6ms
04-19 13:59:06.198: D/dalvikvm(26070): GC_CONCURRENT freed 250K, 5% free 8330K/8736K, paused 2ms+2ms, total 24ms
04-19 13:59:06.198: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 8ms
04-19 13:59:06.258: D/dalvikvm(26070): GC_CONCURRENT freed 317K, 6% free 8527K/8996K, paused 2ms+3ms, total 25ms
04-19 13:59:06.258: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 10ms
04-19 13:59:06.258: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 10ms
04-19 13:59:06.378: D/dalvikvm(26070): GC_CONCURRENT freed 271K, 5% free 8689K/9128K, paused 2ms+6ms, total 31ms
04-19 13:59:06.378: D/dalvikvm(26070): WAIT_FOR_CONCURRENT_GC blocked 13ms
04-19 13:59:06.398: D/dalvikvm(26070): GC_FOR_ALLOC freed 283K, 8% free 8558K/9260K, paused 23ms, total 23ms
04-19 13:59:06.438: D/dalvikvm(26070): GC_FOR_ALLOC freed 303K, 8% free 8566K/9260K, paused 26ms, total 26ms
04-19 13:59:06.478: D/dalvikvm(26070): GC_FOR_ALLOC freed 325K, 8% free 8567K/9260K, paused 25ms, total 25ms
04-19 13:59:06.518: D/dalvikvm(26070): GC_FOR_ALLOC freed 304K, 8% free 8568K/9260K, paused 25ms, total 25ms
04-19 13:59:06.538: E/Google Maps Android API(26070): Failed to load map. Could not contact Google servers.
04-19 13:59:06.598: D/dalvikvm(26070): GC_CONCURRENT freed 381K, 8% free 8579K/9260K, paused 6ms+4ms, total 51ms
Did you check the correct services are enabled? Once I had a similar problem, and my issue was I accidentally enabled Google Maps API v2 in place of Google Maps Android API v2.
Please check that you are enabled the correct Google map API service for android, which is Google Maps Android API v2.
As it looks your problem is those two permissions:
<permission
android:name="com.example.cs2110_final.TheHunt.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.cs2110_final.permission.MAPS_RECEIVE" />
Which should be identical from the point of your package name, meaning if in one you wrote:
com.example.cs2110_final
which is your package name, then the second one should be the same, like that:
<permission
android:name="com.example.cs2110_final.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.cs2110_final.permission.MAPS_RECEIVE" />
In addition make sure you are following all the steps of producing your API key, you can follow this guide I wrote on this topic:
Google Maps API V2 Key
Another problem I see in your code is the fact that you min target API version 8 (android:minSdkVersion="8"), So you should use the SupportMapFragment and FragmentActivity and not MapFragment and a simple Activity as you are doing right now. But as far as my knowledge goes this doesn't have to do anything with the problem you are having right now.
Still you will have to change it, you can follow this guide I wrote to do that:
Google Maps API V2
I am tring to implement google maps using the new google maps api v2 and for some reason i don't see a map.
I think that the problem is those two lines of error when i run it on the emulator:
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
when i run the application on the device the following error is produced:
Could not find class 'maps.j.k', referenced from method map.y.ae.a
My problem looks the same as in this link: http://android-er.blogspot.co.il/2012/12/google-maps-android-api-v2-with-blank.html
There it's says that the problem may be my key so i went and reproduced it using the following tutorial: http://android-er.blogspot.co.il/2012/12/displaying-sha1-certificate-fingerprint.html. but this still didn't helped me.
the support files are of course add to the project as well as the Google play services lib.
I see the same result on the emulator (after adding manually the two file that allow using the google map v2 on the emulator) as well as on the motorola Defy running android 2.2.
Maybe I am using the wrong debug.keystore? I am using the one in my User.android folder.If so then how do i find the right file?
EDIT: My eclipse says that my debug key is in the default folder. So i renamed the debug.keystore file and ran the Eclipse to recreate it all over again. That resulted in producing a new SHA1 key. I used it to create a new Google Maps API v2 key but the result is still the same. I'm still unable to see the map.
EDIT2: Stupid me, I chose Google Map API V2 instead of Google Maps Android API V2.
This question can be closed. Thanks.
Here are all the code files:
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:cameraBearing="112.5"
map:cameraTargetLat="-33.796923"
map:cameraTargetLng="150.922433"
map:cameraTilt="30"
map:cameraZoom="13"
map:mapType="normal"
map:uiCompass="false"
map:uiRotateGestures="true"
map:uiScrollGestures="false"
map:uiTiltGestures="true"
map:uiZoomGestures="true" />
</LinearLayout>
Map Fragmentactivity class:
package com.eadesign.skygiraffefinalv2;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import android.os.Bundle;
import com.google.android.gms.maps.*;
import android.widget.ImageView;
import android.widget.TextView;
public class Map extends android.support.v4.app.FragmentActivity
{
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()) == 0)
{
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
// map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}
}}
manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eadesign.skygiraffefinalv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.eadesign.skygiraffefinalv2.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/sgicon90"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
<activity
android:name=".Map"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My key"/>
</application>
log from logcat:
ent.category.LAUNCHER] flg=0x10000000 cmp=com.eadesign.skygiraffefinalv2/.Map u=
0} from pid 1362
W/WindowManager( 148): Failure taking screenshot for (246x410) to layer 21010
D/AndroidRuntime( 1362): Shutting down VM
I/ActivityManager( 148): Start proc com.eadesign.skygiraffefinalv2 for activity
com.eadesign.skygiraffefinalv2/.Map: pid=1373 uid=10046 gids={3003, 1015, 1028}
D/dalvikvm( 1373): Not late-enabling CheckJNI (already on)
D/dalvikvm( 1362): GC_CONCURRENT freed 99K, 77% free 483K/2048K, paused 1ms+1ms,
total 13ms
D/jdwp ( 1362): Got wake-up signal, bailing out of select
D/dalvikvm( 1362): Debugger has detached; object registry had 1 entries
E/jdwp ( 1373): Failed sending reply to debugger: Broken pipe
D/dalvikvm( 1373): Debugger has detached; object registry had 2 entries
E/Trace ( 1373): error opening trace file: No such file or directory (2)
D/dalvikvm( 1373): GC_CONCURRENT freed 204K, 3% free 8264K/8519K, paused 89ms+6m
s, total 161ms
D/dalvikvm( 1373): WAIT_FOR_CONCURRENT_GC blocked 33ms
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
E/ActivityThread( 1373): Failed to find provider info for com.google.settings
D/dalvikvm( 1373): GC_CONCURRENT freed 312K, 5% free 8471K/8839K, paused 82ms+10
5ms, total 268ms
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
E/ActivityThread( 1373): Failed to find provider info for com.google.android.gsf
.gservices
D/dalvikvm( 1373): GC_CONCURRENT freed 227K, 4% free 8797K/9095K, paused 91ms+11
0ms, total 300ms
D/libEGL ( 1373): Emulator without GPU support detected. Fallback to software r
enderer.
I/Choreographer( 1373): Skipped 54 frames! The application may be doing too muc
h work on its main thread.
D/gralloc_goldfish( 1373): Emulator without GPU emulation detected.
D/libEGL ( 1373): loaded /system/lib/egl/libGLES_android.so
I/ActivityManager( 148): Displayed com.eadesign.skygiraffefinalv2/.Map: +3s545ms
I/Choreographer( 1373): Skipped 75 frames! The application may be doing too muc
h work on its main thread.
In my case I chose Google Maps API V2 instead of Google Maps Android API V2. After changing that the problem was gone. So this code is perfectly fine to create a full screen Google map and the question can be closed.
Thanks.