Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED....by tamoghna - android

I have a problem with the Google maps activity......I'm getting the error of Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED........following code of Google maps activity.............
package com.tommy.maps;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class Main extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
Log.e("key", "ok");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.e("key", "ok2");
}
}
xml file in layout
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tommy.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<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="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name="com.google.android.maps" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.tommy.maps.Main"
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="API_KEY" />
<meta-data>
</meta-data>
</application>
</manifest>
I have posted the manifest and xml code and java code ......please tell me my error and tell me what to do for the error......
my log cat messages are:-
12-26 15:06:00.160: I/Choreographer(546): Skipped 31 frames! The application may be doing too much work on its main thread.
12-26 15:06:00.330: I/Choreographer(546): Skipped 52 frames! The application may be doing too much work on its main thread.
12-26 15:06:00.600: I/Choreographer(546): Skipped 80 frames! The application may be doing too much work on its main thread.
12-26 15:06:01.361: D/AndroidRuntime(1480): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
12-26 15:06:01.361: D/AndroidRuntime(1480): CheckJNI is ON
12-26 15:06:01.470: D/dalvikvm(1480): Trying to load lib libjavacore.so 0x0
12-26 15:06:01.490: D/dalvikvm(1480): Added shared lib libjavacore.so 0x0
12-26 15:06:01.590: D/dalvikvm(1480): Trying to load lib libnativehelper.so 0x0
12-26 15:06:01.590: D/dalvikvm(1480): Added shared lib libnativehelper.so 0x0
12-26 15:06:01.770: E/cutils-trace(1480): Error opening trace file: No such file or directory (2)

As you minimum api level is 8 so you need you SupportMapFragment besides MapFragment in your xml file. Change your layout as below :
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
In your MainActivity extend FragmentActivity besides Activity as below:
public class Main extends FragmentActivity{

Try to place this in your xml file: <fragment....../>
and even try to generate api key try to place it....
and even
Just delete "gen"folder . It build automatically.
Application will work fine.

Related

deep linking error android

i was trying to to build an flashlight app but when i tried to run it the app stopped and gave me this error:
03-20 12:18:39.590 437-455/system_process I/PackageManager﹕ Removing non-system package:com.example.flashlight
03-20 12:18:39.840 437-455/system_process I/PackageManager﹕ Running dexopt on: com.example.flashlight
03-20 12:18:46.340 24099-24099/com.example.flashlight E/Trace﹕ error opening trace file: No such file or directory (2)
03-20 12:18:46.360 24099-24099/com.example.flashlight W/dalvikvm﹕ Refusing to reopen boot DEX '/system/framework/hwframework.jar'
03-20 12:18:46.760 24099-24099/com.example.flashlight W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41d7e438)
This is my code:
public class MyActivity extends Activity {
/**
* Called when the activity is first created.
*/
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Camera cam = android.hardware.Camera.open();
Camera.Parameters parameters = cam.getParameters();
ToggleButton toggleButton = (ToggleButton)findViewById(R.id.toggleButton);
try {
if (toggleButton.isChecked()){
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
} else {
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
}
} catch (Exception e){
e.printStackTrace();
}
my main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New ToggleButton"
android:id="#+id/toggleButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true"/>
</RelativeLayout>
and my manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flashlight"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:targetSdkVersion="16"
android:minSdkVersion="9"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:name="MyActivity"
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>
i understand that a deep link error has something to do with the internet but i do not have anything like that in the app.
Please help cause i can't figure out what is wrong with this code.
you dont add permission to use camera. add permission and then try again.
add these
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
for reference , see here : http://developer.android.com/reference/android/hardware/Camera.html

Error Fatal Exception: main & Inflating Class Fragment

I am following this tutorial , i used the original files provided in the tutorial but facing same problem.searched for many pre asked questions but could not find way to repair my error.I m having error of "Unfortunately app has stopped" I got errors in logcat as follow.
Logcat of my project
11-30 17:35:36.852: E/Trace(836): error opening trace file: No such file or directory (2)
11-30 17:35:37.432: D/AndroidRuntime(836): Shutting down VM
11-30 17:35:37.432: W/dalvikvm(836): threadid=1: thread exiting with uncaught exception
(group=0x40a13300)
11-30 17:35:37.452: E/AndroidRuntime(836): FATAL EXCEPTION: main
11-30 17:35:37.452: E/AndroidRuntime(836): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gmap/com.example.gmap.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
.java file as follows
public class MainActivity extends FragmentActivity
implements OnMapClickListener {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
mMap.setOnMapClickListener(this);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public void onMapClick(LatLng position) {
mMap.addMarker(new MarkerOptions()
.position(position)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
}
}
Manifest file as follow
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gmap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<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" >
<!-- You must insert your own Google Maps for Android API v2 key in here. -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="I inserted key obtained" />
<activity
android:name="com.example.gmap.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>
Your Java code seems to be correct. Try to remove the implements onClickListener and onClick method just for a try. Your manifest needs some changing. I suggest adding these elements:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.nurakanbpo.mygenie.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.nurakanbpo.mygenie.MAPS_RECEIVE" />
Your minSdkVersion is 13 for which you dont need supportmapfragment. You can use mapfragment.
Also since revision 13 of google play services was released you need to add this element to your you application tag:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

Google Play Service library and Google Maps

I try to create a simple GoogleMap by Using Google Play Service and Google Maps API. But all the times I get errors...
I´m working with IntelliJ 12.1, here my full Code:
RecorderMap.java
package com.example.GPSApp;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class RecorderMap extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
}
map.xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.gms.maps.SupportMapFragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.GPSApp"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<permission
android:name="com.example.GPSApp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.newmapview.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".RecorderMap"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="XXX" />
</application>
</manifest>
I think the Problem is how I include the GooGlePlayService... I´ve tried to add as module, as libary as External Libary but I don't know how to include and to use it right... :(
EDIT:
LogCat
08-28 07:41:59.869: ERROR/AndroidRuntime(23080): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.GPSApp/com.example.GPSApp.RecorderMap}: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.gms.maps.SupportMapFragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.gms.maps.SupportMapFragment
at android.view.LayoutInflater.createView(LayoutInflater.java:508)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:210)
at android.app.Activity.setContentView(Activity.java:1660)
at com.example.GPSApp.RecorderMap.onCreate(RecorderMap.java:18)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
... 11 more
Caused by: java.lang.NoSuchMethodException: SupportMapFragment(Context,AttributeSet)
at java.lang.Class.getMatchingConstructor(Class.java:643)
at java.lang.Class.getConstructor(Class.java:472)
at android.view.LayoutInflater.createView(LayoutInflater.java:480)
... 20 more
****EDIT2**
Problem solved by using this: java.lang.noclassdeffounderror: com.google.android.gms.R$styleable**
The only thing I find missing in your RecorderMap.java file is that you haven't imported the SupportFragment class. So add this line to it
import com.google.android.gms.maps.SupportMapFragment;
If that doesn't work, then check out the following.
From what you are saying, it means you have already installed the google play services. If not, then try installing it using this link http://developer.android.com/google/play-services/setup.html
After that, referencing the google play services library should be as easy as editing your build.gradle file. The current version of android studio makes this possible. Under dependencies in your build.gradle file, add the following code
compile 'com.google.android.gms:play-services:3.1.36'
You seem to have your API key intact.
Finally, remember you need to test your app on an actual android device and not an emulator. The android API version 2 is not yet able to display maps on emulators.
I think this should be okay for your app to work.

while using Google Maps Android API v2 got error Signature not valid. Found:

I'm creating sample application to use Google Maps Android API v2.
I tried on Samsung Galaxy Ace GT-S5830i, but instead of Map, I'm seeing
And logcat is
Signature not valid. Found:
MIIDDTCCAfWgAwIBAgIEEhX+gTANBgkqhkiG9w0BAQsFADA3MQswCQYDVQQGEwJVUzEQMA4GA1UE
ChMHQW5kcm9pZDEWMBQGA1UEAxMNQW5kcm9pZCBEZWJ1ZzAeFw0xMzAyMjUxMTEwNDRaFw00MzAy
MTgxMTEwNDRaMDcxCzAJBgNVBAYTAlVTMRAwDgYDVQQKEwdBbmRyb2lkMRYwFAYDVQQDEw1BbmRy
b2lkIERlYnVnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApqChoDnHsDfsxa7n2Kv9
2av0G0tm+kS1uP4T6fA8cO6jB3qB5EHFR6+5UO+k4laHW2WzOJbyhhtFE5eOTS4Zt5qo4FX/hsc/
Zi7dDX/Y13b+4qajhLoGYqVjM00eQc2qF58TTnbQ3lTERxaofYL2qI3j2KcVODFMksinL9lt3RTD
V3MXy7KDLcuSvoVZxXn1L0O9rkTbZicmleK4wLDzI+lTpuXngAuQ4MBH1wEWwqMhJg6/J06t5axU
ea2UVv7ZtYg8KPMEiQEApCbdAHtQsmqcsEQZtJAqFtj7KEQ7wTSgnpDRix4N5C9QlwUtKSlOCIlk
ueUPVBypKf/SWIgF6QIDAQABoyEwHzAdBgNVHQ4EFgQURyMuspjlLaDj8LhEb5UyYqQgWQYwDQYJ
KoZIhvcNAQELBQADggEBAA9IXLEAQTD+VEt9l8JQDEOFv8WqIdQisvmJCfJjN98faarvf6RRA+v3
HF2VFlZPaUu/HBeOH8MI7u+gNuRtZGYWn1eC/qfP0W31MQoNaN4ocsF+tL9INzpd89/u6Ya5Kove
r0E0tpJFBgdtDPYcPBjQ6tYAqmhnmPIJftGHLNQbil4ocK/PkqgxGlwQN7WrCNjDewb0twz7hZBx
Ig4OsnfdgPTYGlR+LyTzUd9/KyqaLHivRAI+y/xGDz6lOfGH7bDOPi/hDm0bkhC1y1J7L9+FiGWb
dmi+Co9Jlf1f3vyTtD7kr3h0K0C3MsNWtybVqmVvgImoLt/lPbjNJahVrds=
Google Play services signature invalid.
Can't open keycharmap file
Error loading keycharmap file
Using default keymap
My manifest code
<?xml version="1.0" encoding="utf-8"?>
<permission
android:name="com.example.testmap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.testmap.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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" />
<permission
android:name="com.example.testmap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDTsWrO0j24sbp4E5qhoHhd6nyOQM5lErc" />
<activity
android:name="com.example.testmap.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>
my xml file code
<?xml version="1.0" encoding="utf-8"?>
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
My activity code
package com.example.testmap;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.final_main);
GoogleMap map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
//map.getMinZoomLevel();
}
}
And clicking on ok button gives force close with Logcat
FATAL EXCEPTION: main
java.lang.NullPointerException
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374)
at android.app.Activity.startActivityForResult(Activity.java:2827)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
at android.app.Activity.startActivity(Activity.java:2933)
at com.google.android.gms.internal.e$2.onClick(Unknown Source)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Also when I UN-comment last line map.getMinZoomLevel(); , I get null pointer exception on the line.
Check if you have enabled offline work for gradle: Goto File > Settings > Gradle
Deselect Offline Work if its checked.
Then confirm if you have latest version of google services mentioned as dependencies in project level build.gradle:
classpath 'com.google.gms:google-services:2.1.0'
You can find latest version here: https://jcenter.bintray.com/com/android/tools/build/gradle/
Clean and build the project after gradle sync completes.
ouThese steps solved a similar issue I'd with Google Maps and also solved the first error you mentioned Signature Not Valid
If your device runs on Android M, you may want to verify your code for location access following this answer.
I was also getting same exception and I fixed it.
Note: I am working on google analytics and was getting this exception. But my app was not crashing I was getting this in Logs. you can also try this solution.
add this in project level gradle file.
classpath 'com.google.gms:google-services:2.1.0'
and this one for module level gradle file.
compile 'com.google.android.gms:play-services:8.4.0'
and move `below plugin at the end of file (at last line) of module level gradle file.
apply plugin: 'com.google.gms.google-services'

MapActivity could'nt get connection factory client

I've been looking for much on google about the problem, but I have not resolved. The map is displayed, but I located at the point where I want and still giving me the same failure:
06-09 12:10:57.231: I/MapActivity(1532): Handling network change
notification:CONNECTED 06-09 12:10:57.231:
W/IdleConnectionHandler(1532): Removing a connection that never
existed! 06-09 12:11:04.829: W/KeyCharacterMap(1532): Can't open
keycharmap file 06-09 12:11:04.829: W/KeyCharacterMap(1532): Error
loading keycharmap file 06-09 12:11:04.829: W/KeyCharacterMap(1532):
Using default keymap 06-09 12:11:57.080: I/MapActivity(1785): Handling
network change notification:CONNECTED 06-09 12:11:57.080:
E/MapActivity(1785): Couldn't get connection factory client
And I do not understand because I've followed all the steps to generate the api key, my Activity extends from MapActivity, and and I added my android manifiest permits and libraries.
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.XXX.XXX"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activities.Gmaps"/>
</application>
</manifest>
Gmaps Activity
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
public class Gmaps extends MapActivity{
private MapView mapa = null;
private MapController control = null;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gmaps);
mapa = (MapView)findViewById(R.id.mapa);
mapa.setBuiltInZoomControls(true);
Double latitud = 40.4166909;
Double longitud = -3.7003454;
GeoPoint loc = new GeoPoint(latitud.intValue(), longitud.intValue());
control = mapa.getController();
control.setCenter(loc);
control.setZoom(7);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
gmaps.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="#+id/mapa"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0htJ1gM0WymyYYokI3eUunfuJ2-XXXXXXXXX"
android:clickable="true"/>
</RelativeLayout>
Sorry for my english !! jeje :)
Sign your application with a keystore and generate an apk for your application using this keystore.Then install this on your device. This would solve your problem.The map api key you are using must be generated with this keystore only.

Categories

Resources