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.
Related
In eclipse there are no red errors, but when I try to run application it say unfortunately button has stopped.
LogCat
11-09 10:13:33.134: D/AndroidRuntime(1007): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-09 10:13:33.144: D/AndroidRuntime(1007): CheckJNI is ON
11-09 10:13:33.184: D/dalvikvm(1007): Trying to load lib libjavacore.so 0x0
11-09 10:13:33.204: D/dalvikvm(1007): Added shared lib libjavacore.so 0x0
11-09 10:13:33.264: D/dalvikvm(1007): Trying to load lib libnativehelper.so 0x0
11-09 10:13:33.264: D/dalvikvm(1007): Added shared lib libnativehelper.so 0x0
11-09 10:13:34.124: D/AndroidRuntime(1007): Calling main entry com.android.commands.pm.Pm
11-09 10:13:34.184: D/AndroidRuntime(1007): Shutting down VM
11-09 10:13:34.204: D/dalvikvm(1007): GC_CONCURRENT freed 101K, 78% free 466K/2048K, paused 1ms+1ms, total 15ms
11-09 10:13:34.204: D/dalvikvm(1007): Debugger has detached; object registry had 1 entries
11-09 10:13:34.815: D/AndroidRuntime(1020): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-09 10:13:34.815: D/AndroidRuntime(1020): CheckJNI is ON
11-09 10:13:34.884: D/dalvikvm(1020): Trying to load lib libjavacore.so 0x0
11-09 10:13:34.904: D/dalvikvm(1020): Added shared lib libjavacore.so 0x0
11-09 10:13:34.964: D/dalvikvm(1020): Trying to load lib libnativehelper.so 0x0
11-09 10:13:34.964: D/dalvikvm(1020): Added shared lib libnativehelper.so 0x0
11-09 10:13:36.064: D/AndroidRuntime(1020): Calling main entry com.android.commands.am.Am
11-09 10:13:36.134: I/ActivityManager(151): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.bogdanskoric.button/.MainActivity u=0} from pid 1020
11-09 10:13:36.144: W/WindowManager(151): Failure taking screenshot for (246x410) to layer 21005
11-09 10:13:36.194: D/dalvikvm(1030): Not late-enabling CheckJNI (already on)
11-09 10:13:36.204: D/AndroidRuntime(1020): Shutting down VM
11-09 10:13:36.224: I/AndroidRuntime(1020): NOTE: attach of thread 'Binder_3' failed
11-09 10:13:36.244: D/dalvikvm(1020): GC_CONCURRENT freed 102K, 77% free 489K/2048K, paused 6ms+1ms, total 29ms
11-09 10:13:36.254: I/ActivityManager(151): Start proc com.bogdanskoric.button for activity com.bogdanskoric.button/.MainActivity: pid=1030 uid=10046 gids={1028}
11-09 10:13:36.254: D/jdwp(1020): Got wake-up signal, bailing out of select
11-09 10:13:36.254: D/dalvikvm(1020): Debugger has detached; object registry had 1 entries
11-09 10:13:36.334: I/Choreographer(248): Skipped 43 frames! The application may be doing too much work on its main thread.
11-09 10:13:36.714: E/Trace(1030): error opening trace file: No such file or directory (2)
11-09 10:13:37.234: I/Choreographer(248): Skipped 104 frames! The application may be doing too much work on its main thread.
11-09 10:13:37.324: D/AndroidRuntime(1030): Shutting down VM
11-09 10:13:37.324: W/dalvikvm(1030): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
11-09 10:13:37.344: E/AndroidRuntime(1030): FATAL EXCEPTION: main
11-09 10:13:37.344: E/AndroidRuntime(1030): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bogdanskoric.button/com.bogdanskoric.button.MainActivity}: java.lang.RuntimeException: Binary XML file line #11: You must supply a layout_width attribute.
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.os.Handler.dispatchMessage(Handler.java:99)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.os.Looper.loop(Looper.java:137)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-09 10:13:37.344: E/AndroidRuntime(1030): at java.lang.reflect.Method.invokeNative(Native Method)
11-09 10:13:37.344: E/AndroidRuntime(1030): at java.lang.reflect.Method.invoke(Method.java:511)
11-09 10:13:37.344: E/AndroidRuntime(1030): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-09 10:13:37.344: E/AndroidRuntime(1030): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-09 10:13:37.344: E/AndroidRuntime(1030): at dalvik.system.NativeStart.main(Native Method)
11-09 10:13:37.344: E/AndroidRuntime(1030): Caused by: java.lang.RuntimeException: Binary XML file line #11: You must supply a layout_width attribute.
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5458)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:5594)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.widget.RelativeLayout$LayoutParams.<init>(RelativeLayout.java:1099)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:956)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:70)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-09 10:13:37.344: E/AndroidRuntime(1030): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.Activity.setContentView(Activity.java:1867)
11-09 10:13:37.344: E/AndroidRuntime(1030): at com.bogdanskoric.button.MainActivity.onCreate(MainActivity.java:22)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.Activity.performCreate(Activity.java:5008)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-09 10:13:37.344: E/AndroidRuntime(1030): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-09 10:13:37.344: E/AndroidRuntime(1030): ... 11 more
11-09 10:13:37.364: W/ActivityManager(151): Force finishing activity com.bogdanskoric.button/.MainActivity
11-09 10:13:37.374: W/WindowManager(151): Failure taking screenshot for (246x410) to layer 21010
11-09 10:13:37.894: W/ActivityManager(151): Activity pause timeout for ActivityRecord{4159fd60 com.bogdanskoric.button/.MainActivity}
11-09 10:13:38.234: I/Choreographer(248): Skipped 36 frames! The application may be doing too much work on its main thread.
MainActivty
package com.bogdanskoric.button;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity implements View.OnClickListener
{
Button buttonE;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonE = (Button) findViewById(R.id.button);
buttonE.setOnClickListener (this);
}
private void buttonClick ()
{
startActivity(new Intent ("com.bogdanskoric.button.EmocijeActivityMainActivity"));
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId())
{
case R.id.button:
buttonClick();
break;
}
}
}
activity_main
<RelativeLayout 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.bogdanskoric.button.MainActivity" >
<TextView
/>
<Button
android:id="#+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="33dp"
android:layout_marginTop="42dp"
android:text="#string/button"
/>
</RelativeLayout>
EmocijeActivityMainActivity
package com.bogdanskoric.button;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class EmocijeActivityMainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.emocije_activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.emocije_activity_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Button manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bogdanskoric.button"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
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" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EmocijeActivityMainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.bogdanskoric.button.EmocijeActivityMainActivity" />
<category android:name="android.intent.category.DEFOULT" />
</intent-filter>
</activity>
</application>
</manifest>
The error says it all : Binary XML file line #11: You must supply a layout_width attribute.
Basically the error is that you have not defined any layout_width and layout_height in the xml attribute of TextView...
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
... Other Attributes
/>
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)
Alright, I've been going thru posts left and right trying to figure out this error.. I've managed to fix a few errors, but this is just driving me nuts.. it has almost no information.. or atleast none that makes any sense to me.
D/dalvikvm(431): Trying to load lib /data/data/com.hyperlinkup.manglerbt/lib/libventrilo_interface.so 0x405156c8
D/dalvikvm(431): Added shared lib /data/data/com.hyperlinkup.manglerbt/lib/libventrilo_interface.so 0x405156c8
D/dalvikvm(431): No JNI_OnLoad found in /data/data/com.hyperlinkup.manglerbt/lib/libventrilo_interface.so 0x405156c8, skipping init
D/dalvikvm(431): GC_EXTERNAL_ALLOC freed 61K, 53% free 2565K/5379K, external 1027K/1038K, paused 89ms
W/dalvikvm(431): No implementation found for native Lcom/hyperlinkup/manglerbt/VentriloInterface;.debuglevel (I)I
D/AndroidRuntime(431): Shutting down VM
W/dalvikvm(431): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime(431): FATAL EXCEPTION: main
E/AndroidRuntime(431): java.lang.UnsatisfiedLinkError: debuglevel
E/AndroidRuntime(431): at com.hyperlinkup.manglerbt.VentriloInterface.debuglevel(Native Method)
E/AndroidRuntime(431): at com.hyperlinkup.manglerbt.ServerList.onCreate(ServerList.java:96)
E/AndroidRuntime(431): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime(431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime(431): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime(431): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(431): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(431): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(431): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(431): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(431): at dalvik.system.NativeStart.main(Native Method)
I/Process(431): Sending signal. PID: 431 SIG: 9
I'm trying to rework the Mangler app to use Bluetooth recording (via startBluetoothSco), but I want to make sure the original is working before incorporating the bluetooth functionality.. Any help I can get on this matter would be greatly appreciated.
edit: thinking maybe my issue is with jni_wrappers.c.. first 3 #include's are unresolved.. original build was on linux system it would appear, so it's looking for jni.h, stdint.h and ventrilo3.h
Answer is in the Logcat Stacktrace itself
No implementation found for native Lcom/hyperlinkup/manglerbt/VentriloInterface;.debuglevel (I)I D/AndroidRuntime(431): Shutting down VM
There is a Native method called debuglevel in VentriloInterface. You have not implemented that method. So, the VM throws java.lang.UnsatisfiedLinkError.
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 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.