I have problem with testing my application on device.
I already successfully open the localhost in browser from my device, but when i enter my ip to connect my application with web service it didn't work.
I always get the "unfortunately, [my apps name] has stopped" message.
Anyone who knows about this problem, please help me. I really need help to solve this. thank you very much
logcat - i get it from usb debug on device
06-10 11:31:15.551: D/dalvikvm(14590): Late-enabling CheckJNI
06-10 11:31:15.809: D/TextLayoutCache(14590): Using debug level: 0 - Debug Enabled: 0
06-10 11:31:15.902: D/libEGL(14590): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
06-10 11:31:15.910: D/libEGL(14590): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
06-10 11:31:15.910: D/libEGL(14590): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
06-10 11:31:16.160: D/OpenGLRenderer(14590): Enabling debug mode 0
06-10 11:31:19.770: D/OpenGLRenderer(14590): Flushing caches (mode 0)
06-10 11:31:22.309: D/OpenGLRenderer(14590): Flushing caches (mode 0)
06-10 11:31:30.848: D/TryLoginCheck(14590): Here
06-10 11:31:30.848: I/System.out(14590): UserNametes
06-10 11:31:30.848: I/System.out(14590): passwordTes12345*
06-10 11:31:30.848: D/Parameters(14590): username=tes&password=Tes12345*
06-10 11:31:30.863: D/AndroidRuntime(14590): Shutting down VM
06-10 11:31:30.863: W/dalvikvm(14590): threadid=1: thread exiting with uncaught exception (group=0x40bd31f8)
06-10 11:31:30.863: E/AndroidRuntime(14590): FATAL EXCEPTION: main
06-10 11:31:30.863: E/AndroidRuntime(14590): android.os.NetworkOnMainThreadException
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.io.IoBridge.connect(IoBridge.java:112)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.net.Socket.connect(Socket.java:842)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:77)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
06-10 11:31:30.863: E/AndroidRuntime(14590): at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.karismaelearning.Login.tryLogin(Login.java:128)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.karismaelearning.Login$3.onClick(Login.java:73)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.view.View.performClick(View.java:3558)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.view.View$PerformClick.run(View.java:14157)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.Handler.handleCallback(Handler.java:605)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.Handler.dispatchMessage(Handler.java:92)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.os.Looper.loop(Looper.java:137)
06-10 11:31:30.863: E/AndroidRuntime(14590): at android.app.ActivityThread.main(ActivityThread.java:4514)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 11:31:30.863: E/AndroidRuntime(14590): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
06-10 11:31:30.863: E/AndroidRuntime(14590): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
06-10 11:31:30.863: E/AndroidRuntime(14590): at dalvik.system.NativeStart.main(Native Method)
06-10 11:31:30.918: D/dalvikvm(14590): GC_CONCURRENT freed 237K, 6% free 6863K/7239K, paused 2ms+2ms
you are getting android.os.NetworkOnMainThreadException :
The exception that is thrown when an application attempts to perform a networking operation on its main thread.
This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it's heavily discouraged.
do your code this way in side AsyncTask
Related
there is no error in application but when running it in android emulator I get a sorry message saying my application "has stopped unexpectedly. Please try again".I'm new in android and don't know what is wrong. Please help me.
Logcat is as follows:
06-10 16:55:38.587: D/szipinf(460): Initializing inflate state
06-10 16:55:45.569: D/szipinf(460): Initializing inflate state
06-10 16:55:48.497: D/szipinf(460): Initializing inflate state
06-10 16:55:51.207: I/dalvikvm(460): Jit: resizing JitTable from 512 to 1024
06-10 16:55:53.140: D/szipinf(460): Initializing inflate state
06-10 16:56:02.108: D/AndroidRuntime(460): Shutting down VM
06-10 16:56:02.108: W/dalvikvm(460): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-10 16:56:02.188: E/AndroidRuntime(460): FATAL EXCEPTION: main
06-10 16:56:02.188: E/AndroidRuntime(460): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.uvwxy.footpath/de.uvwxy.footpath.gui.Loader}: java.lang.StringIndexOutOfBoundsException
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.os.Looper.loop(Looper.java:123)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-10 16:56:02.188: E/AndroidRuntime(460): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 16:56:02.188: E/AndroidRuntime(460): at java.lang.reflect.Method.invoke(Method.java:507)
06-10 16:56:02.188: E/AndroidRuntime(460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-10 16:56:02.188: E/AndroidRuntime(460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-10 16:56:02.188: E/AndroidRuntime(460): at dalvik.system.NativeStart.main(Native Method)
06-10 16:56:02.188: E/AndroidRuntime(460): Caused by: java.lang.StringIndexOutOfBoundsException
06-10 16:56:02.188: E/AndroidRuntime(460): at java.lang.String.substring(String.java:1651)
06-10 16:56:02.188: E/AndroidRuntime(460): at de.uvwxy.footpath.gui.Loader.onCreate(Loader.java:231)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-10 16:56:02.188: E/AndroidRuntime(460): ... 11 more
06-10 16:56:12.558: I/Process(460): Sending signal. PID: 460 SIG: 9
As you can tell by reading the stack trace, you have a StringIndexOutOfBoundsException, stemming from line 231 of your de.uvwxy.footpath.gui.Loader class, in its onCreate() method.
You're getting a StringIndexOutOfBoundsException in the Loader.java class at line 231. Check the substringing you're doing at that line.
Trying with the facebook sdk and want to try running the sample app profilepicture .Follow all the step of configuration given in the facebook.developer official site .While import of the facebook sdk some error and exclaimation mark came but that thing are solved .But while running the simple app profilepicture some exception are showing on the logcat.here the details of the logcat with classnotfound exception:
06-10 18:06:48.039: I/Process(621): Sending signal. PID: 621 SIG: 9
06-10 18:08:22.509: W/dalvikvm(697): Unable to resolve superclass of Lcom/facebook/samples/profilepicture/ProfilePictureSampleActivity; (59)
06-10 18:08:22.621: W/dalvikvm(697): Link of class 'Lcom/facebook/samples/profilepicture/ProfilePictureSampleActivity;' failed
06-10 18:08:22.621: D/AndroidRuntime(697): Shutting down VM
06-10 18:08:22.640: W/dalvikvm(697): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
06-10 18:08:22.689: E/AndroidRuntime(697): FATAL EXCEPTION: main
06-10 18:08:22.689: E/AndroidRuntime(697): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.facebook.samples.profilepicture/com.facebook.samples.profilepicture.ProfilePictureSampleActivity}: java.lang.ClassNotFoundException: com.facebook.samples.profilepicture.ProfilePictureSampleActivity
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.access$600(ActivityThread.java:122)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.os.Looper.loop(Looper.java:137)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.main(ActivityThread.java:4340)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 18:08:22.689: E/AndroidRuntime(697): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 18:08:22.689: E/AndroidRuntime(697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 18:08:22.689: E/AndroidRuntime(697): at dalvik.system.NativeStart.main(Native Method)
06-10 18:08:22.689: E/AndroidRuntime(697): Caused by: java.lang.ClassNotFoundException: com.facebook.samples.profilepicture.ProfilePictureSampleActivity
06-10 18:08:22.689: E/AndroidRuntime(697): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
06-10 18:08:22.689: E/AndroidRuntime(697): ... 11 more
so can anyone tell me what will be the solution for this exception.and this exception is coming for every sample app which came with the facebook sdk.Thanks for any hint.
Following the My First Triangle tutorial from this link: My First Triangle
the desktop version works perfectly fine, however when i deploy the android emulator version i get this error:
Unfortunately, MyFirstTriangleAndroid has stopped.
Any suggestions to help fix this problem? I'm using libgdx-0.9.4.
here is the catlog:
06-10 15:32:00.623: D/dalvikvm(528): Not late-enabling CheckJNI (already on)
06-10 15:32:01.653: E/dalvikvm(528): Could not find class 'com.test.myfirsttriangle.MyFirstTriangle', referenced from method com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate
06-10 15:32:01.653: W/dalvikvm(528): VFY: unable to resolve new-instance 684 (Lcom/test/myfirsttriangle/MyFirstTriangle;) in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;
06-10 15:32:01.653: D/dalvikvm(528): VFY: replacing opcode 0x22 at 0x0003
06-10 15:32:01.653: D/dalvikvm(528): DexOpt: unable to opt direct call 0x1c88 at 0x05 in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;.onCreate
06-10 15:32:01.713: D/dalvikvm(528): Trying to load lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): Added shared lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): No JNI_OnLoad found in /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8, skipping init
06-10 15:32:01.783: D/AndroidRuntime(528): Shutting down VM
06-10 15:32:01.783: W/dalvikvm(528): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-10 15:32:01.793: E/AndroidRuntime(528): FATAL EXCEPTION: main
06-10 15:32:01.793: E/AndroidRuntime(528): java.lang.NoClassDefFoundError: com.test.myfirsttriangle.MyFirstTriangle
06-10 15:32:01.793: E/AndroidRuntime(528): at com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate(MyFirstTriangleAndroidActivity.java:11)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Activity.performCreate(Activity.java:4465)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Looper.loop(Looper.java:137)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 15:32:01.793: E/AndroidRuntime(528): at dalvik.system.NativeStart.main(Native Method)
06-10 15:32:06.703: I/Process(528): Sending signal. PID: 528 SIG: 9
This tutorial is kind of outdated. Google decided to change the way dependencies are referenced, you need to go to your Android project's properties -> Java Build Path -> Order & Export tab, and make sure everything is exported (check the boxes).
I'd highly recommend reading this new article detailing the steps required to setup a libgdx project in Eclipse: http://code.google.com/p/libgdx/wiki/ProjectSetupNew?ts=1339344711&updated=ProjectSetupNew
Additionally i'd recommend going through the new developer guide wiki articles, here is the table of contents: http://code.google.com/p/libgdx/wiki/TableOfContents?tm=6
Is there any way to restart/shutdown a phone directly from an application?
For Example:
I need to restart/shutdown my Phone when i meet some specific condition...
Citations to Developer Website:
Permission to Reboot?
http://developer.android.com/reference/android/Manifest.permission.html#REBOOT
Permission to Brick the device???
http://developer.android.com/reference/android/Manifest.permission.html#BRICK
Method to reboot???
http://developer.android.com/reference/android/os/PowerManager.html#reboot%28java.lang.String%29
Method to reboot and Wipe??
http://developer.android.com/reference/android/os/RecoverySystem.html#rebootWipeUserData%28android.content.Context%29
Reboot Method in MonkeyRunner/MonkeyDevice:
http://developer.android.com/guide/developing/tools/MonkeyDevice.html#reboot
There are options to brick a device but why not to power-down or restart?
I tried the following code but it throws an exception..
Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.schogini.PowerOff"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.DEVICE_POWER" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".PowerOffActivity"
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>
Java Code:
package com.schogini.PowerOff;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;
import android.view.View;
import android.widget.Button;
public class PowerOffActivity extends Activity {
PowerManager pm;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
Button mBuyButton = (Button) findViewById(R.id.button1);
mBuyButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
pm.reboot("null");
}
});
}
}
Exception thrown in LogCat:
06-10 17:58:29.001: WARN/dalvikvm(2064): threadid=3: thread exiting with uncaught exception (group=0x4001b160)
06-10 17:58:29.001: ERROR/AndroidRuntime(2064): Uncaught handler: thread main exiting due to uncaught exception
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): java.lang.NoSuchMethodError: android.os.PowerManager.reboot
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at com.schogini.PowerOff.PowerOffActivity$1.onClick(PowerOffActivity.java:28)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.View.performClick(View.java:2364)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.View.onTouchEvent(View.java:4179)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.widget.TextView.onTouchEvent(TextView.java:6545)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.View.dispatchTouchEvent(View.java:3709)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.os.Looper.loop(Looper.java:123)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at java.lang.reflect.Method.invoke(Method.java:521)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-10 17:58:29.011: ERROR/AndroidRuntime(2064): at dalvik.system.NativeStart.main(Native Method)
Not a standard Android distribution, no. Suitably rooted phones often have access to su/reboot commands, but for an off-the-shelf, commercially available device, no: there is no way to do it.
you need to sign the application with signapk. jar using the following command:
java -jar signapk.jar platform.x509.pem platform.pk8 .apk .apk
for this you need to download and build android source code and flash it on a device. You can find the signapk.jar in the \out\host\linux-x86\framework directory.
for more details please refer to the following link:
http://groups.google.com/group/Android-DevPhone-Updating/tree/browse_frm/month/2010-04?_done=/group/Android-DevPhone-Updating/browse_frm/month/2010-04?&&pli=1
I'm going through the documentation at Hello, MapView to add a MapView to my Activity.
When I launch my Activity, I get an inflation error on the MapView.
Here is the MapView in my layout xml:
<com.google.android.maps.MapView
android:id="#+id/mymap"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:clickable="true"
android:apiKey="withheld"
/>
Here is the code in my MapActivity (the class is named ActivityDetails and extends MapActivity) class:
MapView mMap;
mMap = (MapView) findViewById(R.id.mymap);
mMap.setBuiltInZoomControls(true);
Here is the error:
06-10 09:15:24.277: ERROR/AndroidRuntime(228): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.my.app.activity.ActivityDetails}: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.android.maps.MapView
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.os.Looper.loop(Looper.java:123)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invoke(Method.java:521)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at dalvik.system.NativeStart.main(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.android.maps.MapView
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.Activity.setContentView(Activity.java:1622)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.my.app.activity.ActivityDetails.onCreate(ActivityDetails.java:128)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 11 more
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: java.lang.reflect.InvocationTargetException
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:237)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Constructor.constructNative(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 23 more
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: java.lang.NullPointerException
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:183)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:279)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:254)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 27 more
As far as I can tell, I've done everything correct as described in the documentation. I've set my build target to Google APIs, I've added the uses-library tag to my Manifest, I'm running in an emulator with the Google API target...
The problem was I was calling super.onCreate() after setContentView() in the MapActivity.
You are using the wrong xml for your MapView
The class extending the MapActivity should call setContentView() with the xml containing stuff like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/racemap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_x="0px"
android:enabled="true"
android:clickable="true"
android:apiKey="blahblahblah" />
</LinearLayout>
So instead of using layout_details.xml use layout.xml
Insert this on your xml declaration of the MapView
xmlns:android="http://schemas.android.com/apk/res/android"