Android appt.exe has stopped working - java

Hi I am new to android and am doing some new basic projects. Whenever I try to save a project the alert box saying "unfortunately appt.exe has stopped working appears" and all of a sudden there are many errors that can be seen. I can also see that the R.java file disappears automatically and I dont know what to do next. I read somewhere that to delete the id in style, but cannot see any Id in my styles.xml file. I even deleted the whole SDK and downloaded and started from scratch, so would love if I could find any solution to this annoying problem.

Related

Android Studio - PocketModeLiteSensor Error

I have a problem that I've already described on StackOverflow but still can't solve - Suddenly LogCat stopped working for me - I have no idea why! As soon as I click "Debug" in Android Studio and the app installs on my phone the only error I get in LogCat Tab is E/SensorsHub: PocketModeLiteSensor :input data file descriptor not available - (Bad file descriptor) The worst part is that there is no mention of it on Google! As if no one has had this problem yet!
I'm really asking for help - I've already reinstalled Android Studio, reset my computer, and created a new empty project in which this problem also occurs.
Edit 1:
I poked around a bit on Google - is this error literally telling me there is an error with my sensors? Recently my gyroscope stopped working i.e. I checked with the app that it works but the phone doesn't rotate the screen automatically even when I have auto rotate enabled.

Android studio - MainActivity not declared over and over

I'm using Android studio 3.4.1 on Windows 10 x64 and I'm constantly getting same error over and over.
I can't run the app, because "MainActivity is not declared in AndroidManifest.json", and all code that uses something that requires permissions (NFC, read/write files, atc.) is marked as error, and the message is claiming that the permission is also missing in manifest.
These errors can be simply solved by Syncing grande files, as stated in this question: The activity 'MainActivity' is not declared in AndroidManifest.xml
However, after few minutes, these errors are back there again!
I've tried restarting the IDE many times, invalidating caches, syncing gradle many times...
But nothing helps. I got these errors, I sync gradle, errors are gone, I run the app, make tiny changes in code (like changing string in setText or changing textview margin), try to run it again, and the error is back. I sync gradle again, error is solved, I run the app, then I leave the IDE, Google something, and when I return to the IDE, the error is again back, even if no changes were made to the code.
I tried to Google this issue, but I was only able to find questions where this happend once.
Obviously there something that makes the Android Studio "forget" manifest every few minutes. The issue started to occur after my computer once lost power and shut down, so my first idea was corrupted files (as it could have happend while Android Studio was saving something), but if I ran the app after grande sync, it works fine, and it lasts few minutes before the errors are there back again.
So, as this issue happening once has been asked many times about, and many times there were different replies, I just started trying other suggestions.
I came acros this reply: https://stackoverflow.com/a/52687462/6357453
which suggests deleting folders with cache and other stuff Android Studio has created. I did and as of now, it's been more than an hour without this error, so this propably solved the issue.

Android Studio - package java.awt.image does not exist

I have a problem running my project on Android Studio. I am working on an Android project that has a native Java library inside it. It was running fine all the time. But suddenly when I open Android Studio, I find this error:
There is also an error in the .gradle of the project:
It says that URI is not registered.
When Android Studio is started, I find this message:
It seems that there is something wrong in Java configuration, but I can't find out what is the problem?
It was running fine all the time
Not on Android, it wasn't.
It seems that there is something wrong in Java configuration
No. You are using classes that are not part of the Android SDK.
The java Swing and AWT API are not part of the Android SDK and thus aren't including with it. You must find an Android equivalent image library to use in your app. There are few good ones around just depends on what functionality you need to have available to you in you app. Try searching Picasso and or Volley. Picasso is very popular and well known. it has a lot of feature including networking functionality for loading images from the web. The Volley library isn't an image library but an networking library that contains some predefined classes for loading images over the internet.
So this just happened to me. I'm not 100% on the details of how I got it working again, but its roughly this (on my Mac):
Quit Android Studio
I went to ~/Library/Application%20Support/ and deleted the AndroidStudio3.2 directory
I relaunched Android Studio and I got some warning dialog about plugins not existing.
Chose the button that is something about reinstalling or fixing (or whatever isn't deleting or ignoring)
Another dialog comes up. There are a bunch of plugins that are in red. Deselect all the red ones. Then reselect all those ones that were previously red.
Android Studio asks you something and if you want to restart Android Studio. Pick the thing that includes restarting.
And once Android Studio restarts, chose to rebuild your project, and then it worked.
Good Luck and I hope this works for you too.

Android Studio: Text cursor disappears/gone after open some other class or pasting text in different classes

Android Studio: Text cursor disappears/gone after open some other class or pasting text in different classes.
Cursor is randomly disappear while coding in Android Studio. Currently using version 1.5.1
Some time cursor is only visible in one file either in java or xml
Right click is working but cursor is not visible in java/ or xml file so I am not able to type the code.
Observed scenario
The text cursor is not visible or the cursor is gone when I open a different file (e.g. ApplicationTest.java instead of activity_main.xml) the cursor appears again.
Expected scenario:
The text cursor should be located after the insertion point.
Action taken to solved
I used synchronize, restart Android Studio….. but not able to get solution.
I am using window 7 and I have cleared temp
R&D https://code.google.com/p/android/issues/detail?id=78384
I stuck to this problem so please help me. Appreciate, if anyone can help to troubleshoot.
command + O
type some words
esc
cursor appear, works for me
Just update the date time to proper date time.
Permanent workaround: 1
After studying a lot, I found that my system time was incorrect. (On my pc, it was because of windows time service error and not because of CMOS battery. while in some cases CMOS battery may cause this.).
Just update correct the date/time and the cursor will be visible.
If it is still not, close android studio, update correct and start android studio again.
Permanent workaround: 2
Reinstall windows and immediately install antivirus before installing any other software. (Mome malware can affect the working of time service in PC.). (Those who keep antivirus setup file/s on PC itself or USB device, they must check out whether the setup is clear in itself.).
Workaround: 3
On the left pane in android studio, strangely, all my classes were shown as singleton while they weren't.
I pressed multiple combinations multiple times of alter / shift / ctrl / mouse clicks to to check whether any key is stuck (which seldom happens).
I put Android Studio into power save mode: android studio -> file -> power save mode and tried to work again.
I corrected my system date (it was 2 days behind than current.)
Restarted the PC. The issue is resolved.
Disabled power save mode.
Temporary solution:
No need to close project or android studio.
Click on the scroll button on the right of the editing pane or on suggestions yellow lines somewhere else on the same vertical scroll bar line.
I have same problem too
but I solved with this trick..
Go to File-> Invalidate Caches / Restart
Now cursor should appear..
When the cursor disappeared, you can press Insert key on your keyboard, then the cursor will be appeared again.
Go back and check again.. You might find cursor there..
I am using 3.1.2 of AS on Mac. I faced the same problem after pasting multiple classes in AS. While cursor was gone I was able to make text selection. I checked StackOverflow for the solution and reached this question. After reading a couple of answers I went back to AS workspace and cursor was there...
In Android Studio 4.2 this issue still exists. I've deleted the settings file of the android studio folder by folder to find out which file is causing the error. In windows If you navigate to
C:\Users\{User}\AppData\Roaming\Google\AndroidStudio4.2\options
you will see an other.xml file. You can delete this file. This might fix the issue (at least it fixes it in my case). You can also comment out or delete this line in the other.xml file to fix the issue
<property name="Source Code Editor With PreviewLayout" value="Preview only" />
Just follow this answer for faster solution.
Original Post
In my case the cursor was disappearing when I opened a file/class from recent files dialog. When I deleted a file from the list and opened it again (for example: ctrl + n -> go to class) the cursor was there but then opened it again and the cursor was gone.
The solution for me was to restore default settings from Android studio (invalidate caches/restart didn't help me).
Edit October 2021
It happened again (AS 2020.3.1 running on Ubuntu 20.04)
After restoring to default settings AS makes a backup of your settings files to ~/.config/Google/AndroidStudio2020.3-backup.
I just deleted new files in ~/.config/Google/AndroidStudio2020.3 and copy there the old files and it works! (I didn't proceed through the initial setup of AS, but open my project, then exited it, replaced old settings files and then run again.)
Close the android studio, not just the project instead the IDE. then open it again, wait till it build and then cursor appears.
You might have column select on by accident, turn it off with
ALT + SHIFT + I
this happens because some other text editor is open on PC........close that text editor/other instance of android studio and this will be solved....

My android app "stops unexpectedly"

I have recently got into writing android apps and have hit a brick wall very early on that I can't figure out, and i'm sure it's mind numbingly simple.
Everytime I run it in my emulator, I get the "Stopped unexpectedly" error :/
Files
The main ".java" file and the main.xml are in there, just scroll down.
EDIT: Fixed now, just needed a simple clean :3
Somewhere in your layout XML, there's an invalid element named EditText2. There's no such view in the Android SDK, remove the "2".

Categories