Cannot ever get my android app to run? [closed] - android

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have spent almost two weeks now just trying to run my android game. Every time I run it on my phone from Eclipse it crashes and says "The process closed unexpectedly, please try again" or something like that. I created a new project with just an activity and other basic classes to see what the problem was, and I still get the message. I am not new to Java but am new to android, and I am having a very hard time debugging. I always get this error:
11-16 14:15:55.613: D/AndroidRuntime(9468): Shutting down VM
11-16 14:15:55.613: W/dalvikvm(9468): threadid=1: thread exiting with uncaught exception (group=0x4001d570)
11-16 14:15:55.613: E/AndroidRuntime(9468): FATAL EXCEPTION: main
11-16 14:15:55.613: E/AndroidRuntime(9468): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.stickman.revolution/com.example.stickman.revolution.MainActivity}: java.lang.ClassNotFoundException: com.example.stickman.revolution.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stickman.revolution-2.apk]
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.os.Looper.loop(Looper.java:130)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.reflect.Method.invoke(Method.java:507)
11-16 14:15:55.613: E/AndroidRuntime(9468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-16 14:15:55.613: E/AndroidRuntime(9468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-16 14:15:55.613: E/AndroidRuntime(9468): at dalvik.system.NativeStart.main(Native Method)
11-16 14:15:55.613: E/AndroidRuntime(9468): Caused by: java.lang.ClassNotFoundException: com.example.stickman.revolution.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stickman.revolution-2.apk]
11-16 14:15:55.613: E/AndroidRuntime(9468): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-16 14:15:55.613: E/AndroidRuntime(9468): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-16 14:15:55.613: E/AndroidRuntime(9468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
11-16 14:15:55.613: E/AndroidRuntime(9468): ... 11 more
Here is the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.stickman.revolution"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<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>
</application>

You are getting a ClassNotFoundException your MainActivity and therefore the Activity can't get launched. Check your Android Manifest and look if your Activity is registered.

Related

Android manifest file activity error

12-11 02:45:59.232: E/AndroidRuntime(348): FATAL EXCEPTION: main
12-11 02:45:59.232: E/AndroidRuntime(348): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ass.ui/com.ass.ui.Settings}: java.lang.InstantiationException: com.ass.ui.Settings
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.os.Handler.dispatchMessage(Handler.java:99)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.os.Looper.loop(Looper.java:123)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.reflect.Method.invokeNative(Native Method)
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.reflect.Method.invoke(Method.java:521)
12-11 02:45:59.232: E/AndroidRuntime(348): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-11 02:45:59.232: E/AndroidRuntime(348): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-11 02:45:59.232: E/AndroidRuntime(348): at dalvik.system.NativeStart.main(Native Method)
12-11 02:45:59.232: E/AndroidRuntime(348): Caused by: java.lang.InstantiationException: com.ass.ui.Settings
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.Class.newInstanceImpl(Native Method)
12-11 02:45:59.232: E/AndroidRuntime(348): at java.lang.Class.newInstance(Class.java:1429)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-11 02:45:59.232: E/AndroidRuntime(348): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-11 02:45:59.232: E/AndroidRuntime(348): ... 11 more
this is my Logcat error, and below is the android manifest file. This works yesterday and i havent changed a single letter and the error persists now.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ass.ui"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.ass.ui.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>
<activity
android:name="com.ass.ui.Settings"
android:configChanges="orientation"
android:label="#string/app_name"
android:noHistory="true"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
Seems I cant see where Im wrong here. Tnx for a help.
The problem lies with your Java class, not the configuration. Most probably your activity class has no public empty constructor or it is abstract.

Android apk keeps crasing , probably issue with the manifest, please have a look

I have no idea what can be wrong, maybe you are able to spot it i spend the last hour trying to fix it and the app just keeps crashing on start-up, dont really understand why is that. Thanks in advance!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.miniproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:label="#string/app_name"
android:name=".splashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.miniproject.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:label="#string/app_name"
android:name=".tableScreen">
</activity>
</application>
</manifest>
Log:
p.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.ActivityThread.access$700(ActivityThread.java:135)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.os.Handler.dispatchMessage(Handler.java:102)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.os.Looper.loop(Looper.java:137)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.ActivityThread.main(ActivityThread.java:4998)
11-16 23:20:04.613: E/AndroidRuntime(1323): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 23:20:04.613: E/AndroidRuntime(1323): at java.lang.reflect.Method.invoke(Method.java:515)
11-16 23:20:04.613: E/AndroidRuntime(1323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
11-16 23:20:04.613: E/AndroidRuntime(1323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
11-16 23:20:04.613: E/AndroidRuntime(1323): at dalvik.system.NativeStart.main(Native Method)
11-16 23:20:04.613: E/AndroidRuntime(1323): Caused by: java.lang.RuntimeException: Binary XML file line #1: You must supply a layout_width attribute.
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:492)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5948)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6117)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.widget.FrameLayout$LayoutParams.<init>(FrameLayout.java:615)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:559)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.widget.FrameLayout.generateLayoutParams(FrameLayout.java:56)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.view.LayoutInflater.inflate(LayoutInflater.java:480)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-16 23:20:04.613: E/AndroidRuntime(1323): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.Activity.setContentView(Activity.java:1928)
11-16 23:20:04.613: E/AndroidRuntime(1323): at com.example.miniproject.splashScreen.onCreate(splashScreen.java:17)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.Activity.performCreate(Activity.java:5243)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
11-16 23:20:04.613: E/AndroidRuntime(1323): ... 11 more
11-16 23:20:04.693: D/dalvikvm(1323): GC_FOR_ALLOC freed 473K, 17% free 2712K/3268K, paused 60ms, total 60ms
11-16 23:20:07.973: I/Process(1323): Sending signal. PID: 1323 SIG: 9
11-16 23:20:04.563: W/dalvikvm(1323): threadid=1: thread exiting with uncaught exception (group=0xb4a6fb90)
11-16 23:20:04.613: E/AndroidRuntime(1323): FATAL EXCEPTION: main
11-16 23:20:04.613: E/AndroidRuntime(1323): Process: com.example.miniproject, PID: 1323
11-16 23:20:04.613: E/AndroidRuntime(1323): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.miniproject/com.example.miniproject.splashScreen}: java.lang.RuntimeException: Binary XML file line #1: You must supply a layout_width attribute.
11-16 23:20:04.613: E/AndroidRuntime(1323): at android.ap
It says it plainly "Binary XML file line #1: You must supply a layout_width attribute". So, on one (or more) of your XML layouts, it doesn't have a layout_width attribute. So check your XMLs and make sure all the layouts have one.
From this line: "Binary XML file line #1: You must supply a layout_width attribute", I suppose the parent view of your .xml file did not indicate its width.
It should be like this:
// The parent layout, LinearLayout, or whatever the parent layout is
<LinearLayout 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:orientation="vertical"
android:gravity="center" >
<!- Blah blah-->
</LinearLayout>

App stopped unexpectedly when exited

My application stopped unexpectedly when I pressed the back button and needed to be forced closed. Here's the error log:
11-16 14:57:34.595: E/AndroidRuntime(4899): FATAL EXCEPTION: main
11-16 14:57:34.595: E/AndroidRuntime(4899): java.lang.IllegalStateException
11-16 14:57:34.595: E/AndroidRuntime(4899): at android.media.MediaPlayer.getDuration(Native Method)
11-16 14:57:34.595: E/AndroidRuntime(4899): at com.example.musicshare.AndroidBuildingMusicPlayerActivity$1.run(AndroidBuildingMusicPlayerActivity.java:337)
11-16 14:57:34.595: E/AndroidRuntime(4899): at android.os.Handler.handleCallback(Handler.java:587)
11-16 14:57:34.595: E/AndroidRuntime(4899): at android.os.Handler.dispatchMessage(Handler.java:92)
11-16 14:57:34.595: E/AndroidRuntime(4899): at android.os.Looper.loop(Looper.java:123)
11-16 14:57:34.595: E/AndroidRuntime(4899): at android.app.ActivityThread.main(ActivityThread.java:3691)
11-16 14:57:34.595: E/AndroidRuntime(4899): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 14:57:34.595: E/AndroidRuntime(4899): at java.lang.reflect.Method.invoke(Method.java:507)
11-16 14:57:34.595: E/AndroidRuntime(4899): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
11-16 14:57:34.595: E/AndroidRuntime(4899): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
11-16 14:57:34.595: E/AndroidRuntime(4899): at dalvik.system.NativeStart.main(Native Method)
What could be the problem?
See your log:
11-12 14:21:20.080: E/AndroidRuntime(8843): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.musicshare/com.example.musicshare.ZoneActivity}; have you declared this activity in your AndroidManifest.xml?
You have not declared ZoneActivity on your Android Manifest.. open your Android Manifest and add:
<activity android:name=".ZoneActivity" />
That's the information that is interesting for you:
Unable to find explicit activity class com.example.musicshare/com.example.musicshare.ZoneActivity}; have you declared this activity in your AndroidManifest.xml?
It seems like the Activity that is defined within your manifest does not exist in your code.

Get password from android account

I noticed from Android API, they have this method getPassword(Account account).
accountManager = AccountManager.get(this);
Account[] allGoogleAccounts = accountManager.getAccountsByType("com.google");
for (Account account : allGoogleAccounts)
{
System.out.println(accountManager.getPassword(account));
}
But I have this error:
11-16 10:49:08.986: WARN/System.err(5732): java.lang.SecurityException: caller uid 10039 is different than the authenticator's uid
11-16 10:49:09.038: WARN/System.err(5732): at android.os.Parcel.readException(Parcel.java:1247)
11-16 10:49:09.038: WARN/System.err(5732): at android.os.Parcel.readException(Parcel.java:1235)
11-16 10:49:09.045: WARN/System.err(5732): at android.accounts.IAccountManager$Stub$Proxy.getPassword(IAccountManager.java:415)
11-16 10:49:09.087: WARN/System.err(5732): at android.accounts.AccountManager.getPassword(AccountManager.java:277)
11-16 10:49:09.087: WARN/System.err(5732): at com.test.account.onCreate(account.java:30)
11-16 10:49:09.107: WARN/System.err(5732): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-16 10:49:09.107: WARN/System.err(5732): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-16 10:49:09.125: WARN/System.err(5732): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-16 10:49:09.125: WARN/System.err(5732): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-16 10:49:09.134: WARN/System.err(5732): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-16 10:49:09.156: WARN/System.err(5732): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 10:49:09.156: WARN/System.err(5732): at android.os.Looper.loop(Looper.java:123)
11-16 10:49:09.166: WARN/System.err(5732): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-16 10:49:09.175: WARN/System.err(5732): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 10:49:09.185: WARN/System.err(5732): at java.lang.reflect.Method.invoke(Method.java:521)
11-16 10:49:09.185: WARN/System.err(5732): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-16 10:49:09.195: WARN/System.err(5732): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-16 10:49:09.206: WARN/System.err(5732): at dalvik.system.NativeStart.main(Native Method)
Anyone can tell me my mistake?
From AccountManager.getPassword()
getPassword:
This method requires the caller to hold the permission AUTHENTICATE_ACCOUNTS and to have the same UID as the account's authenticator.
The way I see it you can only get the password if your app was the app that created the account in account manager (Could be mistaking though)
in account manager if you(your app) write the account then only you(your app) can get the password this is because of security that on app could get the password of the user that he used to sync in other app
you can get the password of the account the is created by your process UID every process have it own UID once it runs on the device and continue to have the same UID ever

Using ViewGroup throws NullPointerException

Does anyone have a clue what could be causing this?
11-16 16:23:26.745: ERROR/AndroidRuntime(9549): Uncaught handler: thread main exiting due to uncaught exception
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): java.lang.NullPointerException
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.view.ViewRoot.performTraversals(ViewRoot.java:722)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.os.Looper.loop(Looper.java:123)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at java.lang.reflect.Method.invoke(Method.java:521)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
11-16 16:23:26.765: ERROR/AndroidRuntime(9549): at dalvik.system.NativeStart.main(Native Method)
This error used to show up in our crash reports with some regularity. It was very difficult to track down, but in the end we discovered that we sometimes triggered code that removed a view from the view hierarchy from surfaceDestroyed() (the callback method from SurfaceHolder). If your app is using a SurfaceView, make sure you don't do anything to modify the view hierarchy in surfaceDestroyed().

Categories

Resources