Activity class does not exist - android

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.

Related

After setting up admob my app crashes without error

I set up admob using npm i --save react-native-admob#next and after that implemented of course in my XML file for android the right app-ID which was given to me by admob. I did it just like that:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-****************~*********"/>
Also I implemented into the app gradle file following line:
implementation 'com.google.android.gms:play-services-ads:20.2.0'
The last step I did was going into the nodemodules/react-native-admob/build.gradle and changing one line into this:
implementation 'com.google.android.gms:play-services-ads:19.8.0', before that the build was crashing.
My application now builds and doesnt give me ANY error message, however it closes directly after popping up and Im unable to do anything.
No error logs and nothing else beside that. Tried out several solutions which worked for people here, unluckily it didnt work for me.
same issue i faced with this plugin react-native-admob#next.
try this one https://github.com/react-native-admob/admob

android:targetPackage cannot resolve symbol

this might seem trivial but I can't understand why I'm getting this error.
I downloaded the sample app activityInstrumentation( from Android Studio File -> import Sample) and inside the testing project manifest I get an unresolved symbol for
android:targetPackage="com.example.android.activityinstrumentation".
After that I've created a manifest for my application and still there is an unresolved symbol on the attribute.
My application project dir and test project dir are:
app/src/main/java/com/example/appname
where manifest has
package="com.example.appname"
app/src/androidTest/java/com/example/appname
where manifest has
<manifest
...
package="com.example.appname.tests"
...
android:targetPackage="com.example.appname"
...
</manifest>
Please help me sort this out. I don't know what else I can do: using a sample app to create a full fledged test project was my very last hope.
You must specify android:targetPackage in instrumentation tag.
[http://developer.android.com/guide/topics/manifest/instrumentation-element.html
]
I see the same thing. Seems to be only false alert produced by the lint code inspection. When you run analysis (Analyze->Inspect code...) and open "Inspection" tab you can select the warning and mark it Suppress for tag. That will get rid of the warning.

Using ispeech.org TTS in Android app

I am having trouble using ispeech.org TTS engine with my Android app.
The app crashes on:
java.lang.NoClassDefFoundError: org.ispeech.iSpeechFramework
at org.ispeech.SpeechSynthesis.showProcessingDialog(SpeechSynthesis.java:276)
at org.ispeech.SpeechSynthesis.speak(SpeechSynthesis.java:352)
I have added this line to AndroidManifest.xml:
<activity android:name="org.ispeech.iSpeechFramework" android:configChanges="orientation|keyboard" android:theme="#android:style/Theme.Translucent"/>
However IntelliJ complains that
"'org.ispeech.iSpeechFrameworkd' is not assignable to 'app.android.Activity'"
Can anyone help me understand what I am doing wrong?
org.ispeech.iSpeechFramework is not an activity, so you don't need to add it to your manifest. NoClassDefFoundError is usually a linker/build path error. Try removing the jar and adding it with the instructions in this StackOverflow answer.
If it helps at all, this is how you would fix it in Eclipse.

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.

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

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.

Categories

Resources