Problems with Empty Activity on Android Studio - android

I would really appreciate if someone can help me with my problem:
I am using Android Studio. I want to create the simplest of apps: Just a "Hello World" would be ok.
So I start by creating a new app with an Empty Activity (so far I was using a "Blank Activity" but as you know, they are different.
So I create the basic code (and I find several problems -for example "cant resolve symbol AppCompatActivity- but I dont know how, it got solved...and then I have other problems..etc but...)
So, I finally get a "hello world" app, with everything ready to run. All errors corrected "by magic"- I mean really... anyway I push the Run button.(i am using genimotion by the way cause the native emulator is another problem!) and it starts to run
and I wait.... and wait.... and wait....
it never runs. I can see "gradle processes running"
So I *stop * (by clicking Run-> Stop)
the gradle processes seem to stop
and then the app finally runs succesfully and load into the genimotion emulator and I can run without problems...
So my question is: What is happening here? Why do I have to stop in order to run??
Thanks a lot for any useful help you can give me

Related

App isn't installed on your device error in very first program

There seem to be too many bugs which have not been properly documented, regarding android studio. I am trying to run a basic Hello world app, and this error is truly making me give up any more efforts.
What I did:
Open Android studio(also tried running as administrator) and tried to run the default Hello world app on an Android 10 device(Xiaomi). At the start it shows Failed to start monitoring 7D8XXCOJGQQCZLJV(device number). At first I ignored it being a beginner and clicked on the run button. The file was successfully built and the RUN section shows 'Install successfully finished'.
Now for clarity here are some screenshots that will display what happened on my android device after the above steps:
The app seemed to be installed correctly, but whenever I click on the app logo the response I get is really frustrating:
As per the this link I tried to go to the device manager and do some changes, by setting and enabling Xiaomi drivers for Portable devices.
But then windows shows:
If anybody knows how to solve this, please do help me in doing so. It is quite discouraging to experience so many errors, right at the beginning. If somebody could give a working solution then that would really help me in continuing my android journey.
There was just a tiny error that led to this entire problem. This was because I had set the value of android:exported="false" in the main activity, which had to be set to true. Hope that this may help anybody in the future!
set the value of android:exported="true" in the AndroidManifest

Android Studio shuts down forcefully

I am having a good problem with Android Studio. Initially I was using eclipse to develop android App, but eclipse display funny stuffs like deleting all my codes and most times crashes so I decided to try Android Studio.
Now am using android studio, but whenever I open an activity to start typing code, the IDE forcefully shuts down. Initially i tougth this happens when there is an error in your code, because I had an instance where the IDE shut down, was fixed by correcting the errors. But now the codes are all correct and when I install on emulator it installs properly.
But whenever I open an Activity and start to type Android Studio shuts down. I have tried to check for similar question, but could not find anything suitable. Please I need your help because I have a lot of project with deadlines and this AS behaviour is making me run nuts.. Thanks
There might be memory issue with Android Studio. I recommend you to shutdown all the heavy-weight memory consuming application like Chrome etc. to be shutdown.
I hope it will help.
Thanks all I finally got the solution to the shutdown. I had to create all the Activity used from AS and copy the codes into each file created. Initially i copied all the Activities, resources and Manifest I created in eclipse and paste them into AS. I guess AS doesn't perform auto update and this cause it not have have reference of the pasted files in memory making it to crash.
Sometimes some plugins keep running if studio crashes and they consume so much memory that studio is not able to launch again.
Or see if other applications are running and consuming much memory.
Or you can restart the system.

MyEclipse: Changing Android codes takes no effect

I know this is a rare question. Even if there are people using MyEclipse for Android development is doubted :(
The annoying thing is that after I modified my Android project (like an Activity class of a xml file), the project remained the same as it was when I imported it.
I thought there is an important feature that demonstrates this error: When I run my Android project and the console reported that "Activity not started, its current task has been brought to the front". This line occurs because the project didnt changed while as a matter of fact I did change the project and saved it.
Is there anyone has the same problem like me?
-------------add in Oct. 28-------------------
This was what I did: first, I modified one of my activities by commenting out the Toast functions; and then, I ran it however the Toast line still showed on my Genymotion emulator

Unfortunately has Stopped in Android

Unfortunately appname has stopped, while I am using main activity for both androidmanifest.xml file and for the Java file, so there is no chance of using different activities, but still i am getting this message,like:
Unfortunately LunchList has Stopped.
I am getting this when I am making simple Android app with SQLite database, RSS Reader and much more, but the thing is my codes are working fine because not showing me an error of coding and I am able to run and debug my apps. I am also getting problem with option menus like sometimes menus are not coming, sometimes they are coming but not responding.
but the thing is my codes are working fine because not showing me an error of coding
You mean it's compiling? That's not the same as working. Clearly your code isn't working, otherwise it wouldn't be crashing like this.
You should look in your application's log file (e.g. with logcat). I'm confident it will show you an exception, with a stack trace. That should give you a good idea of what's going wrong, and where it's going wrong. If you find out what's going wrong but don't understand why it's going wrong, that's a reasonable Stack Overflow question in itself, but the first thing is to get that initial diagnostic information.
Note that if you run your app in the debugger, I'd expect that if this error occurs, the debugger should stop to show you where the problem is. (I've never built an Android app, so I can't swear that's the case, but it's a reasonable expectation.)
When you encounter a FC ( Force Close ), You should monitor your application. In Eclipse open the DDMS view and monitor the application with logcat. and see what causes the problem!

Android Emulator Debugging, Code will not Update

I'm having a troubling problem testing some code for and Android app. My app has two parts, and activity where the user changes some settings, and a broadcast receiver that responds to SMS messages, both in the same package.
Here's the problem, I first implemented some simple code to test out the broadcast receiver and the activity, and both worked fine. But then as I tried to refine the code, I noticed the emulator wasn't picking up any of my changes. Event went so far as to uninstall the app from the emulator and try again, no luck. Then I added some extra Toast popups to my receiver, nothing, still running the old code. I know its running the old code because its sending out an SMS using a string constant that is no longer in the current code, so it should be impossible that it respond with that value.
Here's the kicker that has me confused. For fun I made a change to my activity. Ran the project from Eclipse and that change showed up! Tried to test the receiver code again, runs the old code that doesn't even exist anymore!!
How in the world can half the package update, and the other half not?
Can anyone help me out 'cause I'm about ready to lose my mind.
I had a similar problem. Changes made to classes imported from another project didn't get picked up by eclipse, but those made to classes in the current android project were.
Making a change to the current android project (inserting a blank line and deleting it) seemed to make eclipse pick up all the changes made and upload the app to the emulator.
I had this problem too, Now I found a working solution. Just follow these steps:
Run your project normally.
When emulator started, run your project again (DO NOT close the first emulator)
Then the updated application will be uploaded into emulator
I can't really be sure what happened but creating an new emulator image appeared to solve the issue.
I don't know why it happens but it's a problem I have all the time.
What I typically do is
Close the emulator
Close Eclipse
Reopen Eclipse
Clean the projects (in Eclipse, select Project -> Clean... -> Clean all projects)
Rerun the emulator
Annoying as hell but seems to work for me.
I'm having this problem too. It mostly happens when errors are entered into the code. The strange thing is if I go back to the original code, Eclipse doesn't revert to the original code. One thing that seems to help is to temporary delete the contents of a file, save, and rebuild, and then enter the contents back into the file, save, and rebuild.
How is one supposed to debug in such an environment?

Categories

Resources