When i am debugging my application on emulator which is of api level 14(4.0) the application is working fine, but when i am debugging same application on xperia p api level 14(4.0.4)) application has stopped unfortunately, and same application debugging on Samsung duos its working properly, application is working fine with emulator and samsung mobile af api level 14 but why its unfortunately stopped on xperia p with api level 14?
Please help me to understand this issue.
Below is the log:
11-09 13:22:30.678: E/AndroidRuntime(7456): FATAL EXCEPTION: main
11-09 13:22:30.678: E/AndroidRuntime(7456): java.lang.IllegalArgumentException: DrawerLayout must be measured with MeasureSpec.EXACTLY.
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:591)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.View.measure(View.java:12911)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:599)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:381)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.View.measure(View.java:12911)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.ScrollView.onMeasure(ScrollView.java:336)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.View.measure(View.java:12911)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4805)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.FrameLayout.onMeasure(FrameLayout.java:297)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.View.measure(View.java:12911)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.LinearLayout.measureVertical(LinearLayout.java:828)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.LinearLayout.onMeasure(LinearLayout.java:557)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.View.measure(View.java:12911)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4805)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.widget.FrameLayout.onMeasure(FrameLayout.java:297)
11-09 13:22:30.678: E/AndroidRuntime(7456): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2097)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.View.measure(View.java:12911)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.os.Looper.loop(Looper.java:137)
11-09 13:22:30.678: E/AndroidRuntime(7456): at android.app.ActivityThread.main(ActivityThread.java:4441)
11-09 13:22:30.678: E/AndroidRuntime(7456): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 13:22:30.678: E/AndroidRuntime(7456): at java.lang.reflect.Method.invoke(Method.java:511)
11-09 13:22:30.678: E/AndroidRuntime(7456): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
11-09 13:22:30.678: E/AndroidRuntime(7456): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
11-09 13:22:30.678: E/AndroidRuntime(7456): at dalvik.system.NativeStart.main(Native Method)
Related
I am creating an application using Youtube API. It was working fine but after i change the package name using this method I am getting below exception.
com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException
If i change package name back to original with same method the API start to work fine.
I have been changed the applicationId to new package name, restart Android Studio, clean project, rebuiled project but nothing changes.
Stack Track:
11-09 01:49:38.903 10201-10610/com.example.nishant.veuz W/System.err: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAuthIOException
11-09 01:49:38.903 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:299)
11-09 01:49:38.903 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
11-09 01:49:38.903 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
11-09 01:49:38.903 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.example.nishant.veuz.youTubeOperations.YouTubeChannelVideo$2.doInBackground(YouTubeChannelVideo.java:92)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.example.nishant.veuz.youTubeOperations.YouTubeChannelVideo$2.doInBackground(YouTubeChannelVideo.java:88)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at java.lang.Thread.run(Thread.java:818)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: Caused by: com.google.android.gms.auth.GoogleAuthException: UNREGISTERED_ON_API_CONSOLE
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.zze.zzy(Unknown Source)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.zzd.zza(Unknown Source)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.zzd.zzb(Unknown Source)
11-09 01:49:38.904 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.zzd.getToken(Unknown Source)
11-09 01:49:38.905 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.zzd.getToken(Unknown Source)
11-09 01:49:38.905 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.zzd.getToken(Unknown Source)
11-09 01:49:38.905 10201-10610/com.example.nishant.veuz W/System.err: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
11-09 01:49:38.905 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:267)
11-09 01:49:38.905 10201-10610/com.example.nishant.veuz W/System.err: at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:292)
11-09 01:49:38.905 10201-10610/com.example.nishant.veuz W/System.err: ... 12 more
I am developing application to get my current location on the map and display the nearest places.
first my application was running but the camera goes at fixed Latlng ( i put the values) but when i change the code to make the camera on my current location .. my phone shutting down.
This is my logcat:
11-09 08:38:51.010: E/AndroidRuntime(1641): FATAL EXCEPTION: main
11-09 08:38:51.010: E/AndroidRuntime(1641): java.lang.NullPointerException
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.example.buttontest.NearbyActivity.onConnected(NearbyActivity.java:219)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.google.android.gms.internal.u.v(Unknown Source)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.google.android.gms.internal.u$f.a(Unknown Source)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.google.android.gms.internal.u$f.a(Unknown Source)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.google.android.gms.internal.u$b.A(Unknown Source)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.google.android.gms.internal.u$a.handleMessage(Unknown Source)
11-09 08:38:51.010: E/AndroidRuntime(1641): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 08:38:51.010: E/AndroidRuntime(1641): at android.os.Looper.loop(Looper.java:137)
11-09 08:38:51.010: E/AndroidRuntime(1641): at android.app.ActivityThread.main(ActivityThread.java:4898)
11-09 08:38:51.010: E/AndroidRuntime(1641): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 08:38:51.010: E/AndroidRuntime(1641): at java.lang.reflect.Method.invoke(Method.java:511)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
11-09 08:38:51.010: E/AndroidRuntime(1641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
11-09 08:38:51.010: E/AndroidRuntime(1641): at dalvik.system.NativeStart.main(Native Method)
This is where the error
#Override
public void onConnected(Bundle dataBundle) {
// Display the connection status
Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
Location location = mLocationClient.getLastLocation();
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 17);
map.animateCamera(cameraUpdate);
}
NullPointerException is thrown because there might be a possibility that the location you got here Location location = mLocationClient.getLastLocation(); is null. Hence you might always do a null-check.
I have developed an app and it runs as expected on the emulator, but gives error while I run it in my device(HTC one X). Below is the error as shown in the logcat. There is a method which creates a notification. Error appears when this method createNotification() is invoked. Logcat is below:
11-09 13:40:13.350: E/AndroidRuntime(5294): FATAL EXCEPTION: main
11-09 13:40:13.350: E/AndroidRuntime(5294): java.lang.NoClassDefFoundError: android.app.TaskStackBuilder
11-09 13:40:13.350: E/AndroidRuntime(5294): at com.example.accessibility.Accessibility.createNotification(Accessibility.java:205)
11-09 13:40:13.350: E/AndroidRuntime(5294): at com.example.accessibility.Accessibility$1.onClick(Accessibility.java:69)
11-09 13:40:13.350: E/AndroidRuntime(5294): at android.view.View.performClick(View.java:3538)
11-09 13:40:13.350: E/AndroidRuntime(5294): at android.view.View$PerformClick.run(View.java:14319)
11-09 13:40:13.350: E/AndroidRuntime(5294): at android.os.Handler.handleCallback(Handler.java:608)
11-09 13:40:13.350: E/AndroidRuntime(5294): at android.os.Handler.dispatchMessage(Handler.java:92)
11-09 13:40:13.350: E/AndroidRuntime(5294): at android.os.Looper.loop(Looper.java:156)
11-09 13:40:13.350: E/AndroidRuntime(5294): at android.app.ActivityThread.main(ActivityThread.java:5045)
11-09 13:40:13.350: E/AndroidRuntime(5294): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 13:40:13.350: E/AndroidRuntime(5294): at java.lang.reflect.Method.invoke(Method.java:511)
11-09 13:40:13.350: E/AndroidRuntime(5294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-09 13:40:13.350: E/AndroidRuntime(5294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-09 13:40:13.350: E/AndroidRuntime(5294): at dalvik.system.NativeStart.main(Native Method)
I would appreciate if someone can help me fix this error.
TaskStackBuilder is available starting from API level 16 (Android 4.1 otherwise known as Jellybean). Your HTC One X has Android 4.0 on it.
As mentioned by #David Wasser TaskStackBuilder was added in API Level 16 (Android 4.1)
You can solve your problem by adding import android.support.v4.app.TaskStackBuilder; instead of import android.app.TaskStackBuilder;
make sure your app having either v4 / v7 support library added
I hae the same problem as all this topics about the problems of getting zxing working on a project in android, but none of the solutions worked for me. This is the error log:
11-09 11:06:16.009: E/AndroidRuntime(3481): FATAL EXCEPTION: main
11-09 11:06:16.009: E/AndroidRuntime(3481): java.lang.NoClassDefFoundError: com.google.zxing.client.android.R$layout
11-09 11:06:16.009: E/AndroidRuntime(3481): at com.google.zxing.client.android.CaptureActivity.onCreate(CaptureActivity.java:155)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.os.Looper.loop(Looper.java:130)
11-09 11:06:16.009: E/AndroidRuntime(3481): at android.app.ActivityThread.main(ActivityThread.java:3835)
11-09 11:06:16.009: E/AndroidRuntime(3481): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 11:06:16.009: E/AndroidRuntime(3481): at java.lang.reflect.Method.invoke(Method.java:507)
11-09 11:06:16.009: E/AndroidRuntime(3481): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
11-09 11:06:16.009: E/AndroidRuntime(3481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
11-09 11:06:16.009: E/AndroidRuntime(3481): at dalvik.system.NativeStart.main(Native Method)
I have tried lots of combinations inside buildpath, adding the source project, adding de core.jar (named zxing-1.7.jar in my project), addiing it as external library...but when i don't get this problem at the bottom, then i get a dalvik format error, saying Lcom/zxing/android: already added.
I have also tried to put the .jar inside a folder called libs, but none working, checking and unchecking it on build path configs.
here's an image of my current Build Path order, http://postimage.org/image/f496ukwkf/ , but i tried with lots of different combinations, and none of them worked.
Thanks, i need to get it working, please.
You are trying to include code from android/ in your project. You're not intended to do this, and you haven't set it up correctly either. Integrating by Intent (http://code.google.com/p/zxing/wiki/ScanningViaIntent) is far easier if you are new to this. No library code to mess with.
I am trying an example given in o reilys book and testing it on LG P500 but all I get is force close with the following errors:
WARNING: Application does not specify an API level requirement!
[2011-11-09 15:43:38 - dloc] Device API version is 8 (Android 2.2.2)
**p.s i have mentioned api level**
**logcat:**
11-09 16:00:44.738: W/dalvikvm(8002): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)
11-09 16:00:44.738: E/AndroidRuntime(8002): FATAL EXCEPTION: main
11-09 16:00:44.738: E/AndroidRuntime(8002): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.microjobsinc.dloc/com.microjobsinc.dloc.Main}: java.lang.ClassNotFoundException: com.microjobsinc.dloc.Main in loader dalvik.system.PathClassLoader[/data/app/com.microjobsinc.dloc-2.apk]
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.os.Looper.loop(Looper.java:123)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-09 16:00:44.738: E/AndroidRuntime(8002): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 16:00:44.738: E/AndroidRuntime(8002): at java.lang.reflect.Method.invoke(Method.java:521)
11-09 16:00:44.738: E/AndroidRuntime(8002): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-09 16:00:44.738: E/AndroidRuntime(8002): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-09 16:00:44.738: E/AndroidRuntime(8002): at dalvik.system.NativeStart.main(Native Method)
11-09 16:00:44.738: E/AndroidRuntime(8002): Caused by: java.lang.ClassNotFoundException: com.microjobsinc.dloc.Main in loader dalvik.system.PathClassLoader[/data/app/com.microjobsinc.dloc-2.apk]
11-09 16:00:44.738: E/AndroidRuntime(8002): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
11-09 16:00:44.738: E/AndroidRuntime(8002): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
11-09 16:00:44.738: E/AndroidRuntime(8002): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-09 16:00:44.738: E/AndroidRuntime(8002): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-09 16:00:44.738: E/AndroidRuntime(8002): ... 11 more
11-09 16:00:49.848: W/dalvikvm(8013): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)
11-09 16:00:49.858: E/AndroidRuntime(8013): FATAL EXCEPTION: main
Code is written below
public class main extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// find the TextViews
TextView tvLatitude = (TextView)findViewById(R.id.tvLatitude);
TextView tvLongitude = (TextView)findViewById(R.id.tvLongitude);
// get handle for LocationManager
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
// connect to the GPS location service
String providerName = LocationManager.GPS_PROVIDER;
Location loc = lm.getLastKnownLocation( providerName);
// fill in the TextViews
tvLatitude.setText(Double.toString(loc.getLatitude()));
tvLongitude.setText(Double.toString(loc.getLongitude()));
}
}
What is the cause of this problem and how can I fix it?
You need to change the android project properties to use Google Apis with the platform version that you desire.