android application killed right after launch - android

I changed some code on an android application that was working perfectly fine at least 3 days ago (note, this was not three days of coding, I have not done THAT many changes). Now, instead of running along on its merry way, it is ambushed and killed as soon as it gets out of the door. At least, I think that I am interpreting the output correctly:
[2010-08-06 14:07:04 - chart] Android Launch!
[2010-08-06 14:07:04 - chart] adb is running normally.
[2010-08-06 14:07:04 - chart] Performing org.achartengine.chartdemo.demo.ChartDemo activity launch
[2010-08-06 14:07:04 - chart] Automatic Target Mode: using device 'HT03LHF01264'
[2010-08-06 14:07:04 - chart] WARNING: Application does not specify an API level requirement!
[2010-08-06 14:07:04 - chart] Device API version is 3 (Android 1.5)
[2010-08-06 14:07:04 - chart] Uploading chart.apk onto device 'HT03LHF01264'
[2010-08-06 14:07:04 - chart] Installing chart.apk...
[2010-08-06 14:07:08 - chart] Success!
[2010-08-06 14:07:08 - chart] Starting activity org.achartengine.chartdemo.demo.ChartDemo on device
[2010-08-06 14:07:11 - chart] ActivityManager: Can't dispatch DDM chunk 46454154: no handler defined
[2010-08-06 14:07:11 - chart] ActivityManager: Can't dispatch DDM chunk 4d505251: no handler defined
[2010-08-06 14:07:12 - chart] ActivityManager: Starting: Intent { action=android.intent.action.MAIN categories={android.intent.category.LAUNCHER} comp={org.achartengine.chartdemo.demo/org.achartengine.chartdemo.demo.ChartDemo} }
[2010-08-06 14:07:12 - chart] ActivityManager: [1] Killed am start -n org....
Anyway, does anybody have ideas as to what might be causing the immediate killing of a program?
Problem identified by Aidanc. The manifest file that was giving me trouble was
<?xml version="1.0" encoding="utf-8" ?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.achartengine.chartdemo.demo" android:versionCode="1" android:versionName="1.0.0">
- <application android:icon="#drawable/icon" android:label="#string/app_name" android:permission="android.permission.CAMERA">
- <activity android:name=".ChartDemo" android:label="AChartEngine demo">
- <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.achartengine.chartdemo.demo.chart.XYChartBuilder" />
<activity android:name="org.achartengine.GraphicalActivity" />
<activity android:name=".GeneratedChartDemo" />
<activity android:name="DisplayImage" />
</application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-sdk android:minSdkVersion="3" />
</manifest>

perhaps a permissions problem? Have you set permissions correctly for the code you added in the Manifest file? its hard to tell without seeing some code. We need to know what exactly your program does at launch?
Also, whats the Log cat output? does anything run? what's it showing there? does an error show? if it does could you edit your question and put it there?
//edit
<application android:icon="#drawable/icon" android:label="#string/app_name" android:permission="android.permission.CAMERA">
Trying removing android:permission="android.permission.CAMERA" from this

As oliver said, that is a serious problem.
Also I highly highly recommend the use of a version control system to track any and all changes made to your code base. For example GIT or SVN. I think SVN integrates into Eclipse better. That way you could just diff between two versions and know immediately what changed.

Your log says:
WARNING: Application does not specify an API level requirement!
That's quite a problem. There may be something wrong in your manifest around <uses-sdk />
If not, then you could also try Project/Clean in Eclipse to rebuild everything.

Related

Android app not showing on my device. No Launcher Activity Found

I am simply following the Android Developer training guide, and I am already running into troubles on the second step.
I followed the guide (I don't even have to do anything..) and clicked on Run, selected my Galaxy S4 from the screen, and clicked okay. I get the following error
[2014-07-06 19:56:27 - MyFirstApp] Android Launch!
[2014-07-06 19:56:27 - MyFirstApp] adb is running normally.
[2014-07-06 19:56:27 - MyFirstApp] No Launcher activity found!
[2014-07-06 19:56:27 - MyFirstApp] The launch will only sync the application package on the device!
[2014-07-06 19:56:27 - MyFirstApp] Performing sync
[2014-07-06 19:56:27 - MyFirstApp] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-07-06 19:56:31 - MyFirstApp] Application already deployed. No need to reinstall.
[2014-07-06 19:56:31 - MyFirstApp] \MyFirstApp\bin\MyFirstApp.apk installed on device
[2014-07-06 19:56:31 - MyFirstApp] Done!
I honestly have no idea what I am doing wrong, as I have absolutely no experiences with android.
The only thing that is different is in the tutorial their targetSdkVersion is 19, but I am using 21
The following is my AndroidManefiest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
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" >
</application>
</manifest>
You forgot to declare your activity to your Manifest.xml.
Everytime you create an activity (blablabla class extends Activity) you have to declare it to your Android Manifest.xml, in order to de device be able to track your App's life cicle.
What we call Activity is a class that provide information to host a window, the class should extends Activity, all of this classes must be declared on the Manifest.xml file as below:
<application>
...
<activity
android:name="com.yourpackage.ClassName">
</activity>
</application>
Probably your activity class is called MainActivity, you just have to add this to your code, between <application> </application> tag:
<activity
android:name="com.example.myfirstapp.MainActivity"
android:label="#string/app_name"> <!-- This is the text that will appear on your action bar -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The <intent-filter> tells to android that this class is the "main entrance", the first activity that need to be loaded to your app be launched, only the first activity need the <intent-filter> tag, the others just need the fist example I gave.
If you are starting with Android development, I recommend you to read about ActionBar and What to do when the device is rotated
This and this may help you in the future.
Good coding :)
Put the following intent-filter for your activity to be launched.
<activity class=".YourActivity" android:label="your activity label">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
{ action=android.app.action.MAIN } matches all of the activities that
can be used as top-level entry points into an application.
{ action=android.app.action.MAIN,
category=android.app.category.LAUNCHER } is the actual intent used by
the Launcher to populate its top-level list.
Also, please refer to Intent

Where can I find the apk file on my Android phone?

I am trying to develop android applications with eclipse (following this tutorial ). Clicking the 'Run' button inside eclipse (running on Linux) and choosing an android device, eclipse tells me that the application is successfully installed on the device.
[2014-07-02 19:26:55 - MyFirstApp] Installing MyFirstApp.apk...
[2014-07-02 19:27:01 - MyFirstApp] Success!
[2014-07-02 19:27:02 - MyFirstApp] /MyFirstApp/bin/MyFirstApp.apk installed on device
[2014-07-02 19:27:02 - MyFirstApp] Done!
However, I cannot find this application in the list of installed applications on the phone. It only shows up in Settings -> Applications where I am only able to remove it, but not to start it. Maybe I need to do something special in order to let the app show up normally and useable?
As a next step, I installed an 'AppInstaller' to install the apk file. But I do now know which folder on the android phone the apk has been copied to. Where did eclipse put the apk in?
This is in the manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
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" >
</application>
</manifest>
The most likely cause is that you didn't specify a launcher activity in the Manifest.
<activity android:name="... >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
From the documentation:
The ACTION_MAIN action indicates this is the main entry point and does not expect any intent data.
The CATEGORY_LAUNCHER category indicates that this activity's icon should be placed in the system's app launcher. If the
element does not specify an icon with icon, then the system uses the
icon from the element.

Using Hardware Device but cannot find installed app

I followed the procedure on Using Hardware Device from google android's page, after having problems with emulator. After having followed everything provided on google's hardware page, i created a new project and ran it, it gave me the following,
[2014-03-17 18:35:18 - FirstAppProject] ------------------------------
[2014-03-17 18:35:18 - FirstAppProject] Android Launch!
[2014-03-17 18:35:18 - FirstAppProject] adb is running normally.
[2014-03-17 18:35:18 - FirstAppProject] No Launcher activity found!
[2014-03-17 18:35:18 - FirstAppProject] The launch will only sync the application package on the device!
[2014-03-17 18:35:18 - FirstAppProject] Performing sync
[2014-03-17 18:35:18 - FirstAppProject] Automatic Target Mode: using device '0123456789ABCDEF'
[2014-03-17 18:35:18 - FirstAppProject] Uploading FirstAppProject.apk onto device '0123456789ABCDEF'
[2014-03-17 18:35:19 - FirstAppProject] Installing FirstAppProject.apk...
[2014-03-17 18:35:25 - FirstAppProject] Success!
[2014-03-17 18:35:25 - FirstAppProject] \FirstAppProject\bin\FirstAppProject.apk installed on device
[2014-03-17 18:35:25 - FirstAppProject] Done!
Which seem to me that the app is installed on my device, but i cant seem to find the app on my device so that i can test it.
What to do ?
If that is your manifest:
<manifest xmlns:android="schemas.android.com/apk/res/android";
package="com.faizanchaki.firstappproject" android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application android:allowBackup="true"
android:icon="#drawable/ic_launcher" android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!-- no activities declared here -->
</application>
</manifest>
Then you are missing the declaration of a main activity like:
<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>
you should declare the main activity in your Manifest so that your app icon will appear in the android launcher and you will be able to actually start your app. Just put your Activity name and add it to the main manifest where I put the comment.

Android - error while trying to launch: ActivityManager: java.lang.SecurityException: Permission Denial

I'm trying to luanch my application, and this is the log:
[2012-03-07 19:45:12 - hhs] Android Launch!
[2012-03-07 19:45:12 - hhs] adb is running normally.
[2012-03-07 19:45:12 - hhs] Performing hhs.pack.HhsActivity activity launch
[2012-03-07 19:45:15 - hhs] Application already deployed. No need to reinstall.
[2012-03-07 19:45:15 - hhs] Starting activity hhs.pack.HhsActivity on device emulator-5554
[2012-03-07 19:45:16 - hhs] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=hhs.pack/.HhsActivity }
[2012-03-07 19:45:16 - hhs] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=hhs.pack/.HhsActivity } from null (pid=-1, uid=-1) requires null
I've been searching for some answers and understood that the problem is from my manifest file. The problem is that I didn't touch my manifest for a long time (and it works today with the same manifest.
Anyway, as I assume the manifest is important, this is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="hhs.pack"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".HhsActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black" >
</activity>
<activity android:name="SimpleServiceActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".Service.SimpleService"></service>
</application>
</manifest>
The weird thing is:
[2012-03-07 19:45:15 - hhs] Application already deployed. No need to reinstall.
That sound like your app ist deployed. Try to manually deploy it or increase the versionCode.
Try
adb install -r
so he will deploy even if the versionCode is equal or higher to your current versionCode
EDIT
Try to replace this line
<activity android:name="SimpleServiceActivity" android:label="#string/app_name">
with this one:
<activity android:name=".SimpleServiceActivity" android:label="#string/app_name">
Or where ever the package with the activity is located. The important thing here is the [.] before your Activity. Without that it is unknown that your Activity is in the root package.
Make sure you have your app listed in the application nodes. I've had many a times tried to figure out why an app wouldn't run when it was as simple as that.
Also check that you have an intent filter on the activity for android.intent.action.SEARCH
and make sure you have the meta filters:
<meta-data android:resource="#xml/searchable"
android:name="android.app.searchable"></meta-data>
<meta-data android:name="android.app.default_searchable"
android:value=".MyActivity" />

New package not yet registered with the system. Error on a real phone

I am working on an Android project in Eclipse and debugging / testing using my HTC Desire Z. I was coding away building a menu for my app when I started getting this error which is preventing me from continuing. Lots of people have had this error but none of the solutions that I found have worked for me. I tried cleaning and rebuilding the project, manually uninstalling the app from my phone, and renaming the domain in the manifest file. For people using an emulator they talked about deleting the data file but I'm not sure what this translates to when using a real phone.
Here is the console when I try to build:
[2011-08-09 06:57:13 - GreenThumbs] Android Launch!
[2011-08-09 06:57:13 - GreenThumbs] adb is running normally.
[2011-08-09 06:57:13 - GreenThumbs] Performing com.hernblog.GreenThumbs.GreenThumbs activity launch
[2011-08-09 06:57:13 - GreenThumbs] Automatic Target Mode: using device 'HT0ANRV03417'
[2011-08-09 06:57:13 - GreenThumbs] Uploading GreenThumbs.apk onto device 'HT0ANRV03417'
[2011-08-09 06:57:13 - GreenThumbs] Installing GreenThumbs.apk...
[2011-08-09 06:57:16 - GreenThumbs] Success!
[2011-08-09 06:57:17 - GreenThumbs] Starting activity com.hernblog.GreenThumbs.GreenThumbs on device HT0ANRV03417
[2011-08-09 06:57:19 - GreenThumbs] New package not yet registered with the system. Waiting 3 seconds before next attempt.
[2011-08-09 06:57:22 - GreenThumbs] Starting activity com.hernblog.GreenThumbs.GreenThumbs on device HT0ANRV03417
[2011-08-09 06:57:23 - GreenThumbs] New package not yet registered with the system. Waiting 3 seconds before next attempt.
[2011-08-09 06:57:23 - GreenThumbs] ActivityManager: Error: Activity class {com.hernblog.GreenThumbs/com.hernblog.GreenThumbs.GreenThumbs} does not exist.
[2011-08-09 06:57:26 - GreenThumbs] Starting activity com.hernblog.GreenThumbs.GreenThumbs on device HT0ANRV03417
[2011-08-09 06:57:27 - GreenThumbs] New package not yet registered with the system. Waiting 3 seconds before next attempt.
[2011-08-09 06:57:30 - GreenThumbs] Starting activity com.hernblog.GreenThumbs.GreenThumbs on device HT0ANRV03417
[2011-08-09 06:57:30 - GreenThumbs] New package not yet registered with the system. Waiting 3 seconds before next attempt.
[2011-08-09 06:57:33 - GreenThumbs] Starting activity com.hernblog.GreenThumbs.GreenThumbs on device HT0ANRV03417
[2011-08-09 06:57:34 - GreenThumbs] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.hernblog.GreenThumbs/.GreenThumbs }
[2011-08-09 06:57:34 - GreenThumbs] ActivityManager: Error type 3
[2011-08-09 06:57:34 - GreenThumbs] ActivityManager: Error: Activity class {com.hernblog.GreenThumbs/com.hernblog.GreenThumbs.GreenThumbs} does not exist.
And here is my manifest file:
?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hernblog.GreenThumbs"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application>
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.hernblog.Green.Thumbs" android:label="GreenThumbs Tests" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="GreenThumbs"
android:label="#string/app_name"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Any ideas on how to fix this?
I too had this problem immediately after changing the package name of my app (prepping it for Android Market). In Eclipse do a Project > Clean... , then turn off Build-Automatically so you can Build-All.
I got this error after renaming my project package. I fixed it by doing a clean in Eclipse. Then a full rebuild. After that pressing F11 launched the application on the device. (I also uninstalled the application from the device before that but I don't think that was the problem).
I solved this by unchecking the "Is Library" in Project->Properties->Android
Really a confusing Error...and what worked for me is :
Rename the app package name in Manifest xml file to some other name, any!
Save project, try to run it, mine gave lots of errors and didn't run!
Again roll back to old name...save and run!
Cleaning the project didn't work for me. I was able to fix this issue by doing the following:
Add #!/system/bin/sh as the first line /system/bin/am
Add #!/system/bin/sh as the first line /system/bin/pm
I was getting this issue when using some custom ROMs on my phone.
Hope this fixes your problem,
Joey
This is eclipse problem and one of the workaround of this is to rename your package in the manifest for example rename
package="com.hernblog.GreenThumbs"
to
package="com.hernblog.GreenThumbs1"
compile and build this, then put it back to the name you wanted
package="com.hernblog.GreenThumbs"
works as a charm :)
I too got the same error.
And able to resolve with following steps.
In phone that you are testing,
1.go to settings>Apps>Downloaded
2.Go to bottom, I found my app has been disabled.
3.Now uninstall it.
4.In the next run able to install it properly.
Thanks.
Check your package names. At one point you're using com.hernblog.GreenThumbs (unusual to have upper-case package names) then com.hernblog.Green.Thumbs and you even have an activity named com.hernblog.GreenThumbs.GreenThumbs!
I managed to fix this through some voo-doo magic combination of steps. I did many of the things mentioned as answers above, but I think the big fix happened when I updated to a new version of Android.
Thanks for the help guys. I appologize for not having a clear answer on how to fix this problem.
Ok, here's my answer. I was pulling my hair out trying to find the answer to this. I found at his link that the person basically had to create a new project and copy all of the old files into that. So, that's what I did, and it worked! I couldn't believe it. It took me a long time to find it.
However, while working on my new project, I made a change and the same error occurred again. Luckily, I know what change I made, and I undid it and the error cleared.
I added another application tag to the android manifest and it then generated the error. I simply undid it and the error went away.
I opened my app in Google Play, and press "enable"...
Wow! I founded in manifest: android:enabled="false" ... and deleted it!)
I had to reset my device/phone.
Background on how I confused my device:
I pushed the APP.apk to /system/app (this was the wrong place I guess)
I also used eclipse to deploy directly via adb
I then deinstalled manually these apps via settings
then I ran into the cited error "New package not yet registered with the system."
My answer: try test on your friend's device.
I also have the same problem. My Phone is LG lu-3000.
This symptom occurred after I moved my project from Mac to Windows.
After stuck on 10 days I found it runs on Android Virtual Device(but too slow to test anything) and now spent some days more and found out it DOES RUN on the other device!!
Before I tested on AVB and Motorola Bionic, I factory-reset my phone and did everything above. But it didn't change any result. It runs on neither Mac nor Windows.
More disastrous thing is now none of my android project is run on my device..
It is almost 2 years gone from I purchased this device.
If you have deleted the application by hand from the connected device and you still get the same error, please restart the connected device, and it will work correctly!
Check "android:installLocation" in your AndroidManifest.xml.
"preferExternal" will cause the problem.
I too had this problem immediately after changing the package name of my app. In Eclipse go to Project--> Clean, then turn off Build-Automatically so you can Build-All and don't forget to restart the eclipse. Then its working fine for me..
I solved this problem by setting the minimum SDK level of the project lower than the phone's SDK level.
Also try to free memory from the device, uninstall some apps to do this. solved the issue for me.
Make sure you have
<uses-sdk
android:minSdkVersion="yourMinSDKver"
android:targetSdkVersion="youtTargetSDKver" />
on top, in your manifest.xml file. I did swap it by mistake and got this very same error.
I made a really silly mistake. I laughed at when i caught it. There were two application tags in one application!!! have a look
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.riddhi.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".WCFActivity"
android:label="#string/title_activity_main" >
</activity>
</application>
which should be
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.riddhi.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".WCFActivity"
android:label="#string/title_activity_main" >
</activity>
</application>
so i fixed my project. I hope this will be useful to you.
Check your Manifest file. If it has multiple Tags it will face this as it will look for Class in the first Application tag it finds.

Categories

Resources