Hi I have installed Android studio correctly. I made AVD for e.q Marshmallow and project on the same platform. after press RUN, AVD turns on. I can do everything on emulated android phone(other issue- after running this my computer dramticly slowing down) but I should see my "Hello world" app, there is not there. I'm getting following error
Unexpected error while executing: am start -n "com.example.zad2/com.example.zad2.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while Launching activity
where zad2 is my project name.
On Stacfoverflow i saw tips to add into manifest some filter code but I already have it:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.Zad2">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Yea don't trouble friends. I found this post: Session 'app': Error Launching activity
and I unistalled my app from AVD :)
Related
I installed android studio in a usb flash drive because i work on different computers and i don't always wanted to install it. Recently i started it on an
computer that just a week ago worked but when i run the project the IDE try to
run an activity that i've deleated in other computer. I have tried to
rebuild the project, delete the .idea and .gradle folder, disable instant run. Nothing of those success. What can i do?
Error message:
Error while executing: am start -n "bonfra04.com.application/bonfra04.com.application.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=bonfra04.com.application/.MainActivity }
Error type 3
Error: Activity class {bonfra04.com.application/bonfra04.com.application.MainActivity} does not exist.
Error while Launching activity
Now MainActivity does not exist any more.
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bonfra04.com.application">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/GameTheme">
<activity android:name=".Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Game"></activity>
<activity android:name=".ScoreViewer"></activity>
</application>
Directory structure:
In Android Studio at the left of the green Run button, drop down the "app" list and press "Edit Configurations". In the "General" tab check the "Launch options". You must see "Default Activity". If not select it and click OK.
Check your manifest, I bet this activity is still defined as a launcher activity.
I think my issue has something to do with the adb. I searched a lot online and tried to shut it down about 4 different ways and nothing helps. I am using a Mac. Here is what the Run tab of Android Studio says when I run my app:
06/16 16:36:06: Launching app
$ adb push /Users/melloo/Desktop/UCI/Intro-to-Mobile-App-Development-with-
Android/A2-Antoniya.Puleva/app/build/outputs/apk/app-debug.apk
/data/local/tmp/x40240.antoniya.puleva.a2
$ adb shell pm install -r "/data/local/tmp/x40240.antoniya.puleva.a2"
pkg: /data/local/tmp/x40240.antoniya.puleva.a2
Success
$ adb shell am start -n
"x40240.antoniya.puleva.a2/x40240.antoniya.puleva.a2.MainActivity" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 2983 on device Nexus_5X_API_22 [emulator-5554]
Application terminated.
and my manifest:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:launchMode="standard"
>
<activity android:name=".MainActivity"
android:label="List O'Names">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NameListActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name = "x40240.antoniya.puleva.intent.action.ACTION_VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
</application>
Had similar error using Android Studio 3.0 Canary 3. Try doing following things:
Update your Android Studio to the latest version (if you are using 3.0, Canary 4 just came out yesterday)
I see you are using Emulator with Lolipop (api 22), try creating new device with api 25 (Nougat)
Try doing some change in manifest (like adding empty line, the point is to just change the manifest file), then go Build->Clean project and to run it again.
I'm using Android Studio 2.1.3 (Mac OS X) and com.android.tools.build:gradle:2.1.3. I've already tried invalidating cache and restarting and clean builds.
I have a project with many ProductFlavors, all of which use the same starting activity save one (this one is a paid version that uses the licensing library, all the others are free so I don't bother, although a solution might just be to use the licensed version of the activity for all flavors but skip the licensing unless a resource is set... just seems too easy to hack). I thus have 2 AndroidManifest.xml files:
// app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app">
...
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher"
android:label="#string/appFriendlyName"
android:theme="#style/AppTheme">
<activity
android:name="com.company.app.TabsFragmentActivity"
android:screenOrientation="portrait"
android:label="#string/appFriendlyName">
<intent-filter android:label="#string/launcherLabel">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
</manifest>
// app/src/PaidFlavor/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.company.app">
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher"
android:label="#string/appFriendlyName"
android:theme="#style/AppTheme">
<activity
tools:node="merge"
android:name="com.company.app.TabsFragmentActivityLicensed"
android:screenOrientation="portrait"
android:label="#string/appFriendlyName">
<intent-filter android:label="#string/launcherLabel">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
tools:node="remove"
android:name="com.company.app.TabsFragmentActivity"/>
</application>
</manifest>
This works great, and I can inspect the generated intermediate (merged) AndroidManifest.xml, and indeed the TabsFragmentActivity activity is removed, and the TabsFragmentActivityLicensed is added, and all is right with the world.
But I don't want the debug version (build type) to be licensed. Again, I can work around it easy enough in code, but it's the principle of the matter! So I thought it would be easy to just move
app/src/PaidFlavor/AndroidManifest.xml
to
app/src/PaidFlavorRelease/AndroidManifest.xml
This is where things go wrong. Everything builds without error, and I look at the intermediate (merged) manifest and it still looks correct. However, Android Studio tries to launch the PaidFlavor with release build type as:
adb shell am start -n "com.company.project/com.company.app.TabsFragmentActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Wrong activity! Where's it getting it from? Am I using the wrong subdirectory (PaidFlavorRelease/)? This results in the obvious error:
Error while executing: am start -n "com.company.project/com.company.app.TabsFragmentActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.company.project/com.company.app.TabsFragmentActivity }
Error type 3
Error: Activity class {com.company.project/com.company.app.TabsFragmentActivity} does not exist.
Error while Launching activity
I created a splash screen for my android application. In my AndroidManifest I set the SplashScreen Activity as Launcher and action as MAIN. After that I changed the HomeActivity's intentfilter.
Here is my android manifest file:
<application
android:allowBackup="true"
android:icon="#mipmap/icon"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".SplashScreenActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ActivityHome"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.ACTIVITHOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name=".Receivers.NetworkReceiver"></receiver>
</application>
I have both these activities inside the default package. Now, when I try to test the application in device, I get the following error:
Error while executing: am start -n "com.sdz.myapp/com.sdz.myapp.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.sdz.myapp/.SplashScreenActivity }
Error type 3
Error: Activity class {com.sdz.myapp/com.sdz.myapp.SplashScreenActivity} does not exist.
Error while Launching activity
This is how my project structure looks like:
src
-com.sdz.myapp
----ActivityHome
----SplashScreenActivity
I restarted android studio but still the error is there. I dont know what is causing this.
I ran into this as well. I actually had to uninstall the apk from the device before it would work... which was really odd as the app wasn't showing up on my list of apps on the phone.
Here's what I did:
Opened up command line
Ran 'adb devices' to make sure my device was connected
ran 'adb uninstall ' Replace with "com.whatever.blah"
You should see a message saying it uninstall successfully
Try installing from Android Studio again and it should work
I have no idea how it gets in this weird state. :-/
Please change your android:name value at your activity tag with full name and first clean project . After that try to run your application again
<activity android:name="com.sdz.myapp.SplashScreenActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have this same issue occasionally. The solution was to build the APK (menu "Build > Build APK") and install it manually in the phone. After that the error disappears.
I tried all of the above plus even delete the build folder and still did not work. The solution for me was: On your Android Studio go to File->Sync Project with Gradle Files
I have created My First Android Hello World on Android Studio . but when I run it on emulator , it is not running neither installing it on Emulator .. Every time is only shows session '' Error only in log .. i have done restart several times . no use ,
this is my emulator Setting
My Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.facebooklogin" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I have changed the device and skins as well , but no use i have not found proper solution for session '' error .
Since you have just started, Explore Genymotion, a faster and better alternative to Android virtual devices for Android Development.