Cannot run Android application on emulator/device - activity doesn't exist? - android

When trying to run my application on the emulator I get an error from the activitymanager:
ActivityManager: Error type 3
My activity exists, is listed in the manifest (in fact, its the MAIN launcher activity).
Anyone know what this error means?

If you are running Eclipse try Projects-->Clean... and clean the project before running again.

i faced the same issue. I cleaned the project and removed the android:enabled=false in android manifest. This solved the issue.

Check "android:installLocation" in your AndroidManifest.xml.
"preferExternal" will cause the problem.

I got this error because I used invalid characters in my project name and Android didn't warned me about it so I had no idea that was the problem...
Example: "Thís ís íncorrect!"

nothing to worry about that it happens sometimes when activity manager unable to find activity of your app that means your target that is emulator is not started yet or may be because of following reason:
when you try to run your app on emulator you may be cancled in between building or forcefully closed your emulator.In that case when try to start emulator again it will sometimes not maximized.
now you have to restart your eclipse and then launch emulator and run your app now you will not face this type of error

Dont remember how I fixed this - most probably I wiped the local copy and re-checked out of svn.

ActivityManager: Error type 3
I don't know how true it is, but I used the same shared preferences file from another app..and got this error. I chose a new name for the shared preferences and the problem has gone away. It's working now

I had not enough space on my phone, that's why I had this problem.
So I cleaned it and go RUN )

I got this error when I mistakenly added a second application tag in my manifest as I was trying to add hardware acceleration to my app:
<application
android:hardwareAccelerated="true" />.
I added it above my actual application tag and I think this resulted in Android deploying an empty 'app' to my phone. It reported 'Installation success' in the logs and yet there was no launcher icon. It did appear, though, under Settings -> Apps but the only thing I could do there was to uninstall it. Hope this helps someone.

Thus, it seems there can be many reasons to see this error.
For those who can't fix it using the above mentioned methods:
In my case, i renamed the name of my activity (using F2 in Eclipse) and it is fixed.

Related

java.lang.NullPointerException when dataBinding enabled = true

Whenever I enable this in my app gradle
dataBinding {
enabled = true
}
and then sync -> It completely succeed.
but when I "run" it, It builds fail and shows this error
java.lang.NullPointerException
at android.databinding.tool.store.LayoutFileParser.parseOriginalXml(LayoutFileParser.java:135)
at android.databinding.tool.store.LayoutFileParser.parseXml(LayoutFileParser.java:93)
...
my app has little amount of Kotlin code, and android version is 3.5, minSdkVersion 19, targetSdkVersion 28, and upgraded to androidX
How can I solve this? which part should I search for solve this problem???
except above code, every thing works perfect.
Edit
And when I rolled back my code before upgrading to androidX and compiled it, it also shows "Null point exception" and at this time, there are no extra message without just "Null point exception".
Finally I got answer. (cc. android databinding error:Execution failed for task ':app:dataBindingProcessLayoutsDebug')
I guessed it was because of BOM. Someone said it will happen when the code is used in two different circumstances(Window and Mac).
So in 'res' folder, I clicked 'remove BOM' button in android studio and that action changed some xml files.
<?xml version="1.0" encoding="utf-8"?>
But it wasn't worked in Mac. This solution worked only in Window.
I tried a little too much but I figured it out. I created the project on the Mac computer and it wasn't a problem when I switched to windows later. When I tried to create a new file, I got this error and just understood why. Every time I right-clicked on the file I just added, I saw an option called "remove BOM". Clicking this solved my problem. But I did not find the solution to the problem logically, I just found it random.
ex: https://prnt.sc/riw6ex

changing the laucher2 package name android

I am trying to implement my own launcher (making some modifications to the launcher provided by google ). But since i cant remove the default launcher i renamed my package name and everything . Initially the package name was com.android.launcher2 . I changed every instance it to com.rohit.grid . Now if I run it i am getting this error 'Re-installation failed due to different application signatures' .Now the manifest file has some something called com.android.launcher in the permission tags & in the packge name . If i replace it with com.rohit.grid I will get errors in xml files about some resource being not resolved.
I tried cleanoing the project, fixing its properties & everything . But it dint help .
Somebody plz get me out of this problem .
Thanks in advance.
Regards,
Rohit
I think 'Re-installation failed due to different application signatures' means that the installer is trying to install an APK with the same name that an installed one, but the problem in this case is that the installed is signed with a different key than yours.
Instead of modifying your manifest try to rename the project and then reinstall.

Adding a breakpoint in Eclipse, causes Dalvik to crash

This is an interesting bug of Eclipse. I am using:
Version: Indigo Release
Build id: 20110615-0604
Out of nowhere today, I set a breakpoint in my android app on Eclipse. When it reaches the code, debug (dalvik JVM) aborts and crashes:
Tried to execute code in unprepared class (followed by the class name)
If I don't set the break point, it will run through with no problem. I have searched through Google but found nothing so far.
Another note, where I set this breakpoint does not matter, it could simply be the 1st line of onClick() function, or anywhere else. The moment the app "pauses" due to the breakpoint, it crashes.
I run into the same issue; for me, the problem was solved by removing all of the watched expressions I had set up in the debugger (one of them was causing the problem).
I run into the same issue when used watch expression with static method of this (unprepared) class.
I solved this issue by removing this expression from expressions list.
I solved this issue by removing an unused import package.
actually the error message is saying "tried to execute code in unprepared class" (followed by the class name)
I am not using that class but it is imported.
Simply remove the import, and it works fine ....

Activity class does not exist

Aaaargh! I don't know what's going on, but suddenly I can't launch my app. I'm using IntelliJ and I keep getting this error. I thought maybe there was a typo somewhere in the manifest, but there doesn't seem to be. Heres' the error:
Launching application: com.foo.app/com.foo.app.main.
DEVICE SHELL COMMAND: am start -n "com.foo.app/com.foo.app.main"
Starting: Intent { cmp=com.foo.app/.main}
Error type 3
Error: Activity class {com.foo.app/com.foo.app.main} does not exist.
And here's my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.foo.app">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".main">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".NoBellsActivity"/>
</application>
</manifest>
And the strange thing is that ADB shows me that the ActivityManager is starting the intent just fine...
The problem is in the build / run configuration of your project.
You have to check the "Deploy application" checkbox in the Run/Debug Configuration screen, under the General tab.
This solved my problem.
I had a very similar error.
In my case the application was not completely removed from the Android phone.
I simply removed it using ADB, e.g. adb unsinstall com.your_app_name
Check if you don't have another application with the same package id installed on device: https://stackoverflow.com/a/22524188/540639
after checking all other things that people stated in their post, check in the IDEA:
Run -> Edit Configurations -> Android Application -> Launch the activity that you want to start on launch of your application should be there...
I have tried every suggestion i found, but couldnt solve the issue.
After that i figured it out myself:
The problem in my case was that i renamed the package.
To make sure you dont get the error above, add the
defaultConfig {
applicationId "com.yourpackage.yourapplication"
}
to your build.gradle file.
Hope that helps.
I had a problem with identical symptoms and following solved it in my case.
If you're not already, use LogCat window to get more precise information about the exception than console offers.
If you haven't already, check through your layout XML files in case you have a custom object and you're using the wrong path for a resource.
If you haven't already, or you have to address the above, try cleaning your project and then building again.
Rebuild the application and run it.
This solved my problem.
I found an extra <application> </application> tag in my manifest, I don't know how it got there but removing it fixed my issue.
I get this all the time in intellij.
It looks like you are missing the line that states what your default package is e.g. Com.foo. Something is wrong with your manifest there...try creating a new blank test project and compare what you are missing because that looks like it is too short.
Also double check the package and activity name. I got a similar error caused by a missing dot in front of the activity name (e.g. "package.Activity" instead of ".package.Activity" ). IntelliJ didn't mark it as wrong so it was easily overlooked.
Similar to Joff's answer. It seems in Lollipop, when you try to uninstall an application, it doesn't uninstall for all users (although I only have one user).
I just go to the Apps section in Settings, select the application and use the menu and "Uninstall for all users".
I'd had the same problem, after closed Genymotion emulator and connected my phone. Cleaning the project and rerunning solved my problem too.
I had the same issue reported here. I recently added a third activity to my application and it was failing to launch with the same error. To fix the issue, I used a detail posted here. Another developer said that introducing an error to their AndroidManifest.xml file corrected their issue. I did the same: I added a space to cause a compile error, built, got the error reported, corrected the error and then recompiled and deployed and IT WORK.
Hope it fixes your issue.
One Solution:
Just create a new project and copy your classes from the old project into the new project, run the new project and it will probably work, worked for me.
In Android Studio under Run->Edit Configurations check that the package name is correct in the Launch Activity box.
I had an issue with a capital letter in that box that wasn't in the package name.
It happened with me because I forget to add it in manifest file or misspell Class name
I tried many but the problem is confliction of the package. I just invalidated caches and restarted my Android studio and working well.
Hope this may help you!
Probably this answer is too late, but I have to share my experience.
I got this problem while I developed a multi-platform Xamarin app and I was getting:
Error type 3 Error: Activity class {com.companyname.Name/com.companyname.Name.MainActivity} does not exist.
I just solved this issue removing the tag: <category android:name="android.intent.category.LAUNCHER" /> and that's it, problem solved!
NOTE: I'm using a Splash Launcher and that was the reason of my problem, when I added the tag LAUNCHER on my MainActivity all the app crashed.
its as simple as just removing the . (dot) in front of your activitys name. Your main activity should not be dotted. Dots in front of the name means its an child of the main one.

Error:java.lang.NullPointerException in android

[2011-02-18 23:41:16 - ddms]null
java.lang.NullPointerException
at com.android.ddmlib.Client.sendAndConsume(Client.java:571)
at com.android.ddmlib.HandleHello.sendHELO(HandleHello.java:142)
at com.android.ddmlib.HandleHello.sendHelloCommands(HandleHello.java:65)
at com.android.ddmlib.Client.getJdwpPacket(Client.java:670)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:317)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
What kind of error is this..All xml files are having error suddenly like below..
Multiple annotations found at this line:
- Premature end of file.
- error: Error parsing XML: no
element found
thank you,
The first group of errors generally mean that there's a problem in the communication between ddms and the emulator you have fired up. I've found those errors to be generally harmless.
The XML errors sound like you should restart Eclipse (if that's what you're using), or else clean your project. Something got out of sync. (If the problem persists, post an example of the XML that's generating the errors.)
This error started showing up for me after I experimented with deleting files from the AVD. I must of deleted something that was important. I got rid of the error by closing the emulator and deleting the AVD in Eclipse and then recreating and running it.

Categories

Resources