Android app crash (web_view) - java

So Every time i try to run my app, it crashes. Their are no errors in the code.
Its just a simple webview app. But when i run it in the eumlator, i get these errors in the logcat. I tried to look for soultions, but cant find any. I just cant figured out why it keeps crashing. I made a app just like this before, with the same code and had no errors. So i went back and compared the two code, and their the same. I dont know if its a error with android studio, becuase i did update my android studio.
http://i.imgur.com/A2NsPYJ.png
These is the logcat

You may want to take a look at your android manifest file and make sure that the android theme you are using in the webview or app is Theme.AppCompat or a descendant of Theme.AppCompat. This is a weird issue but its happened to me before and I changed the theme to comply with what the error message was telling me, and it worked.

Related

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 emulator keyboard crashes when displaying number keyboard

Whenever I run my android project in emulator and I click on an editText field, the alphabetic keyboard works fine, but when I click on the number keyboard, it crashes with the message: Android Keyboard (AOSP) has stopped.
I thought maybe it was some bad code in my project, so I created a fresh project with no code and a simple editText, same problem.
I tried uninstalling Android Studio and reinstalling, same problem.
I tried running Android Studio on another computer with a different operating system. Same problem.
Any ideas on how to fix this? Thanks
You can configure numeric input for your EditText by using the following in the xml:
`<EditText android:inputType="number `

Emulator in Android Studio won't load

Rendering problems. The following classes could not be instantiated:
- android.support.v7.internal.widget.ActionBarOverlayLayout .
Exception Details:
java.lang.ClassNotFoundException:
android.support.v7.appcompat.R$attr
^^^^^------- (The character represented by the '$' is another character I am unable to write. )
This is what shows up instead of my emulator in android studio. I deleted some projects before this happened and may have mistakenly edited a read-only file. I already tried reinstalling Android Studio and the Android SDK from scratch. Same result. Sometimes it will give an error related to utf-8 and give the option to open up the file encoding. It isn't doing that right now. This brings back the emulator but the drag and drop brings up a small window that can be changed on the emulator. And the problem comes back every time I restart Android Studio.
Is there anything I can do to fix this.
Thank you.
Have you tried to change apptheme? I know some rendering problems or error can be temporarliy fixed by doing this.
Try changing your base application theme using below code - in res/values/styles.xml
It seems to have fixed it for some people. It is also a bugg that will be fixed in a later version. Check the link for more info and some workarounds.
http://tools.android.com/knownissues#TOC-Can-t-Render-Layouts-in-Android-Studio-1.2

Adverts not appearing on my Android App - Google AdMob

I have made an android application and put adverts in using Google AdMob.
On Eclipse's Graphical Layout there is a white rectangle which says 'Ads by Google' in it, which shows that it has been set up properly.
However, when I run the app on the simulator and in real life, nothing shows up. Why would this be?
Thanks in advance!
You should make sure you have setup your Android Application properly with Ads, go over the following steps and ensure that you have done them correctly.
GoogleAdMob Jar in your libs folder
GoogleAdMob Activity in your manifest
GoogleAd AdView in your main activity XML file, with your adunitId correctly inputted
And Ensure your class in which your AdMob is coded in is correct.
Let me know if these steps help you or not.

Android app force closes when theme is set

I'm just getting started with Android dev, done a few tutorials, now I'm working on a simple app. On both the emulator and my phone (Android 4.0.3 emulator, Android 4.1.1 Atrix HD) apps are displaying in what I think is Holo Light. I'd rather have it be Holo Dark, but when I add the following line to the application block in the Android Manifest file: android:theme="#android:style/Theme.Holo" the app compiles fine but force closes as soon as I open it.
What am I doing wrong? I'm sure it's something really simple, but as I said I'm new to this. Thanks in advance, y'all!
If you want to use a theme for all the activities of your application then you need to use
<application android:theme="#style/CustomTheme">
in AndroidManifest.xml.If you want a theme applied to just one Activity in your application, then add the android:theme attribute to the activity tag instead.So need to know what type you use in your application.However see these things which will clear you more..
http://developer.android.com/guide/topics/ui/themes.html
http://www.androidengineer.com/2010/06/using-themes-in-android-applications.html
The simplest thing you can do and you should always do is to read logs why does it crash. The log will tell you the reason of you crash. Please post the reason including logs from Logcat and only then ask about fixes:)

Categories