here is the problem. I'm new with android so i was just designing a simple form with some textfields and button, nothing complicated, and it runs perfectly!
Nevertheless when i add another class in order to work with SQLite database, it doesn't run, and shows the following message: "UNFORTUNATELY, HAS STOPPED"
Please if u have any idea 'bout to fix this problema i'll be more than thankful.
PS: i'm using the ADT BUNDLE FOR WINDOWS which has Eclipse, sdk, sdk manager. just for the record.
...And just in case u ask me for the log error here it is:
Guys thanks a lot for your help! i know it's kinda boring but thanks anyway.
Here is the manifest should i add the new activity in this part of the code or where?
have you created a new activity?
every activity created must be added to the manifest file of the app otherwise the app will crash when that activity is started.
heres how you add it to the manifest:
<activity android:name="com.android.test.ActivityName"
android:label="#string/activity_label" ></activity>
where com.android.test.ActivityName is the name of the activity as it appears in the package
add that between the <application> </application> tags
Related
I just started learning android via the udacity 'android development for beginners' course and they asked us to make an a coffee ordering app.I pasted the MainActivity code given and clicked on run.the app got installed on my phone but doesn't launch.
Error Screenshot
MEntion pacakge name before class name like this...
com.example.abhishek.justjava.MainActivity
and also make sure you activity is present in the right destination with same name....
and plz cross check the package name if you have kept abhishek in package name or not....
also include
<uses-sdk android:minSdkVersion="7" />
You don't have MainActivity.java file in your project. Please insert Activity name correctly instead red text in your manifest.
Hi stack overflow community
I am developing an app for android. There I have to programm that when the backbutton is pressed, the app is send to the background.
I have done this with navigator.app.exitApp(). But I have found out that I get a second instance of the app when I start it new after pressed backbutton.
So I searched and now I want to overwrite the manifest.xml (android:launchMode="singleTask" instead of singleTop. But everytime when I enter cordova run android to put the app on my phone, the manifest.xml will be overwritten (again singleTop instead of the singleTask which I want.
How I can resolve this overwriting? Is it possible to resolve?
I've heard it is/was a bug of cordova? Have they corrected it?
https://issues.apache.org/jira/browse/CB-4911
Ok. What I did so far?
With Notepadd++ I opened the manifest.xml and overwrite the android:launchMode. Then I saved the file and opened the CLI in which I build android or run android.
But everytime these commands have overwritten the manifest.xml file.
Is there another way to modify the file manifest.xml without overwriting?
Thanks for your help.
Instead of using navigator.app.exitApp() you can use moveTaskToBack() but I'm not sure if it exists in cordova.
Also I think you set the wrong parameters because you have to set launchMode instead of label.
android:label="Name of the current activity"
android:launchMode="singleTop"
Hope it helps
I am new to Android and I am trying a few small apps (like Compass). When I run the app in the emulator, it gives the message Unfortunately, Compass has Stopped.
I have no compile time errors.
How do I solve this, and what is causing this?
Thanks in advance.
I had the same error message and found that, in commenting out uses-permission nodes in AndroidManifest.xml I had commented out one that was needed. When I put it back in the app ran fine. I was able to reproduce the error. I needed:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This was for a barebones index.html, single page app, that displays Hello World.
And the permission above was the only one I needed to do Run As/ Android Application and get it to run in an emulator.
HTH
You have posted no code so it's difficult to see what your problem is. However I had the same issue which has been sorted out here Unfortunately HelloListView has stopped
It probably due to the fact that you don't have accelerometer and magnetic field support.
Go to your AVD configuration and add the following hardware: Magnetic Field Support and accelerometer
First check your AndroidManifest.xml file and write activity tag
For example, you have DisplayMessageActivity.class and package is me.user_interface
tag is:
<activity android:name="me.user_interface.DisplayMessageActivity"/>
You can write this after </activity> tag in AndroidManifest.xml file. Check the path carefully.
I have 2 projects in my Eclipse. Both of them have a activity called "MainActivity". The weird thing is, when I tried to launch the 2nd app, the emulator showed an error and pointed it to the 1st app. I can bypass this problem by changing the activity name to something different. Then everything will be fine.
I suppose this is only a emulator problem. I haven't tested it yet but I cannot image this happening on real devices, which will make Android totally unusable.
But still, I need to use the emulator and I'd like to keep the name MainActivity. Has anyone has the same experience before? Thanks in advance.
Do you also have the same package name?
Applications are distinguished by their package names so you should change those on per-project basis.
Update:
In manifest package attribute is prepended to name attribute of Activity. Combined they must be the same as your full qualified class name.
<manifest package="com.myapp">
<activity android:name=".MyActivity"/>
</manifest>
I am learning this via Sams Teach Yourself Android in 24 hours.
This is really strange, I run the app in the emulator and I get my splash screen (just some crappy text really) then I press the home button, and click on my app's icon and it gives me "Application is not installed on your phone"
I went into the emulators settings->applications and it's there!
I cleaned the project, uninstalled it from the emulator and re-ran it. Same damn problem.
(project is simple:
6activities, each has a unique text, as it starts it shows the splash activity
I have not even connected the other activities... just this)
You can download the entire source if you want at http://elxotica.com/TriviaQuiz.rar
Ok, got it working after going to the authors website, downloading the support code and going over it and comparing it line by line.
Basically in my manifest file I had
<activity android:name=".QuizSplashActivity"
android:label="#string/app_name">
and again below I had
<activity android:name="QuizSplashActivity"></activity>
which I thought was needed, but it looks like that should not be declared twice.
I fixed the problem but am not 100% sure of the cause :((
My problem was solved with this error when I moved the INTERNET permission statement in the manifest file out of the activity definition and into the application definition - that is, up in the hierarchy, right under the SDK version declaration:
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:icon="#drawable/icon" blah blah
I also had the permission defined twice. Compiling did not find the bug, however, running the app on the Android emulator did. "Application not installed" is not very helpful, tho. Rather like, "You fowled up [and if you don't know why, I'm not telling you].
I have no problem to run it on Android 2.2 Virtual Device. Maybe you can try create new AVD and run it there. I´ve had similar problem with new update and creating new AVD solved it...
Yeah, I had the same problem.
Just don't declare QuizSplashActivity twice.
Helped in my project, grettz
Yet another failure mode with the same symptom. I had same permission twice, first like this:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
then like this:
<application android:icon="#drawable/icon" android:label="#string/app_name" android:permission="android.permission.WRITE_EXTERNAL_STORAGE">
The second one turns out not only not needed, but also cause the "Application not installed.." error.
So my application declaration looks like this now:
<application android:icon="#drawable/icon" android:label="#string/app_name">
And all is well in the world.
Same symptom, different cause. I'm not entirely certain what happened, but I will hazard a guess in case it helps anyone. What I know for sure: I deleted the icon, dragged it anew from Applications, problem solved.
At some point I changed which Activity was the entry-point (had android.intent.category.LAUNCHER & android.intent.action.MAIN)
I was trying to open the app using an icon on one of my "desktops", an icon which I had added before making the change in the manifest which changed which Activity was MAIN. So I'm guessing that the shortcut refers to the launcher activity and not the app (makes sense)...
My problem was missing assemblies in the package. But only on some phones.
I enabled "link all assemblies" option in the Xamarin studio and problem solved.
Android project options->Android build->Linker behavior->Link all assemblies.
[I'm using Xamarin studio with mono on Android.]